{"id":18792350,"url":"https://github.com/kplanisphere/3d-rotation-parallel","last_synced_at":"2026-04-15T07:38:47.553Z","repository":{"id":242003917,"uuid":"808424757","full_name":"KPlanisphere/3d-rotation-parallel","owner":"KPlanisphere","description":"Proyecto 4 - Graficación","archived":false,"fork":false,"pushed_at":"2024-05-31T03:41:44.000Z","size":275,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-08T00:39:47.105Z","etag":null,"topics":["3d-rotation","computer-graphics","cpp","data-visualization","matrix-transformations","opengl","parallel-rotation","y-axis-rotation","z-axis-rotation"],"latest_commit_sha":null,"homepage":"https://linktr.ee/planisphere.kgz","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KPlanisphere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-31T03:37:35.000Z","updated_at":"2024-05-31T03:53:53.000Z","dependencies_parsed_at":"2024-05-31T04:46:07.798Z","dependency_job_id":"b45316de-34df-4c04-ac2e-efbacd21694f","html_url":"https://github.com/KPlanisphere/3d-rotation-parallel","commit_stats":null,"previous_names":["kplanisphere/3d-rotation-parallel"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/KPlanisphere/3d-rotation-parallel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2F3d-rotation-parallel","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2F3d-rotation-parallel/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2F3d-rotation-parallel/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2F3d-rotation-parallel/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KPlanisphere","download_url":"https://codeload.github.com/KPlanisphere/3d-rotation-parallel/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KPlanisphere%2F3d-rotation-parallel/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268644993,"owners_count":24283410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-04T02:00:09.867Z","response_time":79,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-rotation","computer-graphics","cpp","data-visualization","matrix-transformations","opengl","parallel-rotation","y-axis-rotation","z-axis-rotation"],"created_at":"2024-11-07T21:19:36.373Z","updated_at":"2026-04-15T07:38:42.489Z","avatar_url":"https://github.com/KPlanisphere.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 3D Rotation on Parallel X,Y and Z Axes\n\n### Description\nThis project, completed as part of the coursework at the Benemérita Universidad Autónoma de Puebla, focuses on rotating a 3D pyramid along the Y and Z axes using parallel rotation. The aim is to apply matrix transformations to rotate a 3D object in space, enhancing the understanding of 3D graphics and transformations.\n\n### Overview\nRotating a vertex in 3D space involves altering its components along the x, y, and z axes. This project specifically targets rotations around the Y and Z axes using parallel rotation techniques. The implementation uses matrix multiplication to perform the necessary transformations.\n\n### Objectives\n- Implement parallel rotation for a 3D pyramid using matrix transformations in OpenGL.\n- Apply learned concepts to rotate the pyramid around the Y and Z axes.\n- Develop an understanding of 3D rotations and their applications in computer graphics.\n\n### Key Features\n- **Initialization**: Set up the OpenGL environment and window properties.\n- **Rotation Functions**: Implement functions for rotating the pyramid around the Y and Z axes.\n- **Matrix Operations**: Utilize matrix multiplication for applying transformations.\n- **Animation Loop**: Continuously apply rotations to animate the 3D pyramid.\n\n### Project Structure\nThe project includes the following main components:\n\n#### Initialization\nThis function sets up the OpenGL environment, defining the color of the window and the projection parameters.\n\n```cpp\nvoid init(void) {\n    glClearColor(0.0, 0.0, 0.0, 1.0);\n    glMatrixMode(GL_PROJECTION);\n    glLoadIdentity();\n    gluPerspective(60, 1.0, 1.0, 30.0);\n    glMatrixMode(GL_MODELVIEW);\n    glLoadIdentity();\n    glTranslatef(0.0, 0.0, -3.0);\n}\n```\n\n#### Parallel Rotation\n\nThis function handles the parallel rotation of the pyramid along the specified axis. It first translates the pyramid, performs the rotation, and then translates it back.\n\n```cpp\nvoid Operaciones3D::RotacionParalela(char eje, float theta, float distA, float distB) {\n    switch (eje) {\n        case 'X': // Parallel rotation around X-axis\n            translate(0, -distA, -distB);\n            rotateX(DegToRad(theta));\n            MultM(R, T, A);\n            translate(0, distA, distB);\n            MultM(T, A, A);\n            break;\n        case 'Y': // Parallel rotation around Y-axis\n            translate(0, -distA, -distB);\n            rotateY(DegToRad(theta));\n            MultM(R, T, A);\n            translate(0, distA, distB);\n            MultM(T, A, A);\n            break;\n        case 'Z': // Parallel rotation around Z-axis\n            translate(0, -distA, -distB);\n            rotateZ(DegToRad(theta));\n            MultM(R, T, A);\n            translate(0, distA, distB);\n            MultM(T, A, A);\n            break;\n    }\n}\n```\n\n#### Translation Function\n\nThis function applies a translation to the 3D object by modifying its coordinates.\n\n```cpp\nvoid translate(float dx, float dy, float dz) {\n    float T[4][4] = {\n        {1, 0, 0, dx},\n        {0, 1, 0, dy},\n        {0, 0, 1, dz},\n        {0, 0, 0, 1}\n    };\n    MultM(R, T, A);\n}\n```\n\n#### Rotation Functions\n\nThese functions define the rotation matrices for the X, Y, and Z axes and multiply them with the transformation matrix.\n\n```cpp\nvoid rotateX(float theta) {\n    float R[4][4] = {\n        {1, 0, 0, 0},\n        {0, cos(theta), -sin(theta), 0},\n        {0, sin(theta), cos(theta), 0},\n        {0, 0, 0, 1}\n    };\n    MultM(T, R, A);\n}\n\nvoid rotateY(float theta) {\n    float R[4][4] = {\n        {cos(theta), 0, sin(theta), 0},\n        {0, 1, 0, 0},\n        {-sin(theta), 0, cos(theta), 0},\n        {0, 0, 0, 1}\n    };\n    MultM(T, R, A);\n}\n\nvoid rotateZ(float theta) {\n    float R[4][4] = {\n        {cos(theta), -sin(theta), 0, 0},\n        {sin(theta), cos(theta), 0, 0},\n        {0, 0, 1, 0},\n        {0, 0, 0, 1}\n    };\n    MultM(T, R, A);\n}\n```\n\n#### Matrix Multiplication Function\n\nThis function multiplies two 4x4 matrices.\n\n```cpp\nvoid MultM(float A[4][4], float B[4][4], float C[4][4]) {\n    for (int i = 0; i \u003c 4; i++) {\n        for (int j = 0; j \u003c 4; j++) {\n            C[i][j] = 0;\n            for (int k = 0; k \u003c 4; k++) {\n                C[i][j] += A[i][k] * B[k][j];\n            }\n        }\n    }\n}\n```\n\n### Execution\n\nThe project initializes a graphical window and applies parallel rotations to the pyramid along the Y and Z axes. The rotation is continuous, providing a dynamic visual representation of the 3D transformations.\n\n#### X Axis\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/5c7d5474-0e20-444c-bf29-87825f1ae9f4\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/9a4d3512-7f3b-4e2c-a933-68cffec013d1\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n#### Y Axis\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/7ab02664-9f5f-4ca7-ba5c-da0dc9608baf\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/07f0ac77-6cf3-488b-bcf3-88c3424b99a3\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n#### Z Axis\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/be803370-2c47-49df-805e-c5edd4d1431a\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n\n\u003cp align= \"center\"\u003e\n    \u003cimg src=\"https://github.com/KPlanisphere/binary-tree-operations/assets/60454942/d0438b6c-3b0f-436f-baa1-29dde8b1dc6e\" style=\"width: 70%; height: auto;\"\u003e\n\u003c/p\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkplanisphere%2F3d-rotation-parallel","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkplanisphere%2F3d-rotation-parallel","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkplanisphere%2F3d-rotation-parallel/lists"}