{"id":22248303,"url":"https://github.com/lightaxis/translotator","last_synced_at":"2025-03-25T11:43:19.789Z","repository":{"id":260148661,"uuid":"878452351","full_name":"lightAxis/translotator","owner":"lightAxis","description":"Lightweight C++ header-only template library for translation, rotation and homogeneous transformation. Requires C++17 or Later. No dependencies with other libraries and stl.","archived":false,"fork":false,"pushed_at":"2024-11-30T10:29:26.000Z","size":3108,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-30T10:43:09.196Z","etag":null,"topics":["cpp17","dual-quaternion","embedded","header-only","lie-groups","matrix","quaternion","rigid-body-motions","robotics","rotation","rotation-matrix","se3","so3","template-library","vector"],"latest_commit_sha":null,"homepage":"https://lightaxis.github.io/translotator/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lightAxis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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-10-25T12:22:42.000Z","updated_at":"2024-12-11T09:26:26.000Z","dependencies_parsed_at":"2024-11-14T17:35:24.296Z","dependency_job_id":null,"html_url":"https://github.com/lightAxis/translotator","commit_stats":null,"previous_names":["lightaxis/translotator"],"tags_count":0,"template":false,"template_full_name":"lightAxis/cmake-cpp-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightAxis%2Ftranslotator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightAxis%2Ftranslotator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightAxis%2Ftranslotator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lightAxis%2Ftranslotator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lightAxis","download_url":"https://codeload.github.com/lightAxis/translotator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245458123,"owners_count":20618693,"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","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":["cpp17","dual-quaternion","embedded","header-only","lie-groups","matrix","quaternion","rigid-body-motions","robotics","rotation","rotation-matrix","se3","so3","template-library","vector"],"created_at":"2024-12-03T06:14:58.425Z","updated_at":"2025-03-25T11:43:19.753Z","avatar_url":"https://github.com/lightAxis.png","language":"C++","readme":"# translotator\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"docs/img/logo_resized2.png\"/\u003e\n\u003c/p\u003e\n\nLightweight C++ header-only template library for translation, rotation and homogeneous transformation.  \nRequires C++17 or Later. No dependencies with other libraries and stl.\n\nMore detailed information is available at [[translotator MkDocs Page](https://lightaxis.github.io/translotator/)]\n\n## Features\n\n- Translation, Rotation, Homogeneous Transformation\n- Matrix based objects : Matrix N x M, SquareMatrix N x N, Vector N\n- Number objects : Complex number, Quaternion, Dual number, Dual Quaternion\n- Rotation objects : Unit Complex Number, Unit Quaternion, Axis Angle, Euler Angle, SO(2), SO(3)\n- Transformation objects : SE(2), SE(3), UnitDualQuaternion\n- Supports variaous types of data (float, double, long double)\n- Many operator overloadings for object actions \u0026 data type conversion\n- Supports reinterpret_cast for zero-copy data type conversion between Matrix-based objects.(using this feature to convert temporary object is not recommended)\n- Complile-time dimension check for matrix-based objects\n- Basic Lie algebra \u0026 operation supported : S1, S3, SO(2), SO(3), SE(2), SE(3). Exponential map, Logarithm map.\n- Interpolation : Lerp, Slerp, ScLerp. Also Slerp x Lerp for SE(2), SE(3)\n\n## Matrix-based objects\n\nThese objects are based on Matrix form.\n\n- Matrix (N x M)\n- SquareMatrix (N x N)\n- Vector (N x 1)\n- ComplexNum(2 x 1)\n- Quaternion(4 x 1)\n- DualNumber(2 x 1)\n- DualQuaternion(8 x 1)\n- UnitComplexNum (2 x 1)\n- UnitQuaternion (4 x 1)\n- UnitDualQuaternion (8 x 1)\n- Special Orthogonal Group SO(2), SO(3)\n\nExcept SE(2), SE(3), EulerAngle, AxisAngle, all objects are based on Matrix form.\n\nMatrix-based objects has many operator overloadings between them.\n\n### 1. Copy \u0026 Zero-copy data type conversion\n\nAll matrix-based objects can be converted to each other by using cast function. There are two type of cast function, castContainer() and castContainerRef(). These functions are used for copy and zero-copy data type conversion respectively. Also only allowes the conversion between objects with same matrix-based dimension.\n\ncastContainer() Returns new object with memory copy. Usually used for converting temporary object. Or when you want to keep the original object memory. Some cast functions perform extra steps like normalize, transpose, etc.\n\nAll matrix dimension checks are performed at complile time. If the dimension is not matched, it will cause compile error.\n\n```cpp\nMatrix\u003c3,3,float\u003e mat33;\nSquareMatrix\u003c3,float\u003e sqmat33_a = mat33.castContainer\u003cSquareMatrix\u003c3,float\u003e\u003e();\nSquareMAtrix\u003c3,float\u003e sqmat33_b = mat33.cast2SquareMatrix(); // alias\nMatrix\u003c3,1,float\u003e mat31;\nVector\u003c3, float\u003e v31_a = mat31.castContainer\u003cVector\u003c3,float\u003e\u003e();\nVector\u003c3, float\u003e v31_b = mat31.cast2Vector(); // alias \n```\n\nsome alias functions do extra steps\n\n```cpp\nQuaternion\u003cfloat\u003e quat = Quaternion\u003cfloat\u003e{1.f, Vector\u003c3,float\u003e{{2.f, 3.f, 4.f}}};\n\n// cast the object type and normalize\nUnitQuaternion\u003cfloat\u003e uquat_a = quat.cast2UnitQuaternion(); \n\n// just cast the object type without normalization. \nUnitQuaternion\u003cfloat\u003euquat_b = quat.castContainer\u003cUnitQuaternion\u003cfloat\u003e\u003e(); \n\n// usually cast2UnitQuaternion() is recommended.\n```\n\ncastContainerRef() returns reinterpret_casted object. It is used for zero-copy data type conversion. This is recommended to use when you want to convert the object type without memory copy. Take extra care for temporary objects, can cause undefined behavior, the dangling reference.\n\n```cpp\nMatrix\u003c3,3,float\u003e mat33{{1.f, 2.f, 3.f, \n                        3.f ,4.f, 5.f,\n                        5.f, 6.f, 7.f}};\n// zero-copy type conversion\nconst SquareMatrix\u003c3, float\u003e\u0026 sqmat33_ref_a = mat33.castContainerRef\u003cSquareMatrix\u003c3,float\u003e\u003e();\n// alias\nSquareMatrix\u003c3,float\u003e\u0026 sqmat33_ref_b = mat33.cast2SquareMatrixRef();\n\n// can only read from mat33(0,0), will be 1.f\nfloat val00 = sqmat33_ref_a(0,0); \n// mat33(0,0) also changed to 0.f\nsqmat33_ref_b(0,0) = 0.f;\n\n// reference of temporary object can lead to undefined behavior. \nSquareMatrix\u003c3, float\u003e\u0026 sqmat33_doomed = (mat33 * mat33).cast2SquareMatrixRef();\nsqmat33_doomed(0,0) = 0.f; // undefined behavior\n```\n\nSome alias functions do extra steps, changing the data inside original object.\n\n```cpp\nQuaternion\u003cfloat\u003e quat = Quaternion\u003cfloat\u003e{1.f, Vector\u003c3,float\u003e{{2.f, 3.f, 4.f}}};\n\n// cast the object type and normalize\nconst UnitQuaternion\u003cfloat\u003e\u0026 uquat_ref_a = quat.cast2UnitQuaternionRef();\nfloat norm1 = uquat_ref_a.norm(); // 1.f\nfloat norm2 = quat.norm(); // 1.f , original object is also normalized\n```\n\n### 2. operator+ and operator-\n\nThe operator+, operator- are defined only between same dimension objects.\nReturn type of operator+ and operator- usually follows the left operand type.\nIf operation result violates the property of left operand object, it will be converted to the superset object.  \n(e.g. UnitComplexNum + ComplexNum -\u003e ComplexNum)  \n(e.g. SO(3) + GL(3) =GL(3) )\n\n### 3. operator\\*, operator/*=\n\nThe operator\\* are basically defined only between proper matrix dimension objects.\nReturn type of operator\\*follows the rules of matrix multiplication.\nIf operation result has specific form, it will be converted to the subset object.  \n(e.g. (2x4)\\*(4x3) = Matrix(2x3) )  \n(e.g. (2x3)\\*(3x2) = SquareMatrix(2x2) )  \n(e.g. (2x5)\\*(5x1) = Vector(2x1) )  \n(e.g. SO(3)\\* Scalar = SquareMatrix(3x3) )\n\n### 4. operator\\/, operator\\/=\n\nThe operator/ are defined only between some mathmatical inverse operation objects.  \n(e.g. ComplexNum/ComplexNum = ComplexNum \\* ComplexNum.inverse() )  \n(e.g. SO(3) / SO(3) = SO(3) \\* SO(3)^T )  \n(e.g. SO(3) / Scalar = SquareMatrix(3x3) )\n\n## Hierachy of All objects\n\n![object_hieararchy](/docs/uml/object_hierarchy.png)\n\n## MkDocs Page\n\n**MkDocs page is available for more detailed information.**\n[translotator MkDocs Page](https://lightaxis.github.io/translotator/)\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details\n\n## Contact\n\nlightAxis - \u003cjisuk500@gmail.com\u003e\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightaxis%2Ftranslotator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flightaxis%2Ftranslotator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flightaxis%2Ftranslotator/lists"}