{"id":13830939,"url":"https://github.com/jeremyong/klein","last_synced_at":"2025-07-09T13:30:46.492Z","repository":{"id":39030342,"uuid":"236777729","full_name":"jeremyong/klein","owner":"jeremyong","description":"P(R*_{3, 0, 1}) specialized SIMD Geometric Algebra Library","archived":true,"fork":false,"pushed_at":"2024-08-02T05:53:30.000Z","size":3222,"stargazers_count":742,"open_issues_count":8,"forks_count":57,"subscribers_count":44,"default_branch":"master","last_synced_at":"2024-08-05T10:15:04.195Z","etag":null,"topics":["3d","3d-graphics","algebra","animation","dual-quaternions","geometric-algebra","inverse-kinematics","pga","projective-geometry","quaternion-algebra","quaternions","simd","sse"],"latest_commit_sha":null,"homepage":"https://jeremyong.com/klein","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/jeremyong.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2020-01-28T16:11:18.000Z","updated_at":"2024-08-02T05:53:45.000Z","dependencies_parsed_at":"2022-08-12T22:50:09.217Z","dependency_job_id":"b557fb45-d52c-410f-9e43-50b85155ef2f","html_url":"https://github.com/jeremyong/klein","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyong%2Fklein","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyong%2Fklein/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyong%2Fklein/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jeremyong%2Fklein/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jeremyong","download_url":"https://codeload.github.com/jeremyong/klein/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225553262,"owners_count":17487293,"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":["3d","3d-graphics","algebra","animation","dual-quaternions","geometric-algebra","inverse-kinematics","pga","projective-geometry","quaternion-algebra","quaternions","simd","sse"],"created_at":"2024-08-04T10:01:13.046Z","updated_at":"2024-11-20T12:30:44.620Z","avatar_url":"https://github.com/jeremyong.png","language":"C++","funding_links":[],"categories":["Math","Game-Math","C++","进程间通信"],"sub_categories":["数学"],"readme":"# [Klein](https://jeremyong.com/klein)\r\n\r\n_edit: Project has been temporarily archived as I don't have time to maintain it at the moment. Stay tuned for an updated version of the project in the future._\r\n\r\n[![License: MIT](https://img.shields.io/badge/License-MIT-blueviolet.svg)](https://opensource.org/licenses/MIT)\r\n[![DOI](https://zenodo.org/badge/236777729.svg)](https://zenodo.org/badge/latestdoi/236777729)\r\n\r\n[![Build Status](https://travis-ci.org/jeremyong/klein.svg?branch=master)](https://travis-ci.org/jeremyong/klein)\r\n[![Build Status](https://ci.appveyor.com/api/projects/status/w3ug2ad08jyved8o?svg=true)](https://ci.appveyor.com/project/jeremyong/klein)\r\n[![Coverity Status](https://img.shields.io/coverity/scan/20402.svg)](https://scan.coverity.com/projects/jeremyong-klein)\r\n[![Codacy Badge](https://api.codacy.com/project/badge/Grade/5908bd446f3d4bb0bb1fd2e0808cb8a1)](https://www.codacy.com/manual/jeremyong/klein?utm_source=github.com\u0026utm_medium=referral\u0026utm_content=jeremyong/klein\u0026utm_campaign=Badge_Grade)\r\n\r\n👉👉 [Project Site](https://jeremyong.com/klein) 👈👈\r\n\r\n## Description\r\n\r\nDo you need to do any of the following? Quickly? _Really_ quickly even?\r\n\r\n- Projecting points onto lines, lines to planes, points to planes?\r\n- Measuring distances and angles between points, lines, and planes?\r\n- Rotate or translate points, lines, and planes?\r\n- Perform smooth rigid body transforms? Interpolate them smoothly?\r\n- Construct lines from points? Planes from points? Planes from a line and a point?\r\n- Intersect planes to form lines? Intersect a planes and lines to form points?\r\n\r\nIf so, then Klein is the library for you!\r\n\r\nKlein is an implementation of `P(R*_{3, 0, 1})`, aka 3D Projective Geometric Algebra.\r\nIt is designed for applications that demand high-throughput (animation libraries,\r\nkinematic solvers, etc). In contrast to other GA libraries, Klein does not attempt to\r\ngeneralize the metric or dimensionality of the space. In exchange for this loss of generality,\r\nKlein implements the algebraic operations using the full weight of SSE (Streaming\r\nSIMD Extensions) for maximum throughput.\r\n\r\n## Requirements\r\n\r\n- Machine with a processor that supports SSE3 or later (Steam hardware survey reports 100% market penetration)\r\n- C++11/14/17 compliant compiler (tested with GCC 9.2.1, Clang 9.0.1, and Visual Studio 2019)\r\n- Optional SSE4.1 support\r\n\r\n## Usage\r\n\r\nYou have two options to use Klein in your codebase. First, you can simply copy the contents of the\r\n`public` folder somewhere in your include path. Alternatively, you can include this entire project\r\nin your source tree, and using cmake, `add_subdirectory(Klein)` and link the `klein::klein` interface\r\ntarget.\r\n\r\nIn your code, there is a single header to include via `#include \u003cklein/klein.hpp\u003e`, at which point\r\nyou can create planes, points, lines, ideal lines, bivectors, motors, directions, and use their\r\noperations. Please refer to the [project site](https://jeremyong.com/klein) for the most up-to-date\r\ndocumentation.\r\n\r\n## Motivation\r\n\r\nPGA fully streamlines traditionally used quaternions, and dual-quaternions in a single algebra.\r\nNormally, the onus is on the user to perform appropriate casts and ensure signs and memory layout\r\nare accounted for. Here, all types are unified within the geometric algebra,\r\nand operations such as applying quaternion or dual-quaternions (rotor/motor) to planes, points,\r\nand lines make sense. There is a surprising amount of uniformity in the algebra, which enables\r\nefficient implementation, a simple API, and reduced code size.\r\n\r\n## Performance Considerations\r\n\r\nIt is known that a \"better\" way to vectorize computation in general is to arrange the data in an SoA\r\nlayout to avoid unnecessary cross-lane arithmetic or unnecessary shuffling. PGA is unique in that\r\na given PGA multivector has a natural decomposition into 4 blocks of 4 floating-point quantities.\r\nFor the even sub-algebra (isomorphic to the space of dual-quaternions) also known as the _motor\r\nalgebra_, the geometric product can be densely packed and implemented efficiently using SSE.\r\n\r\n## References\r\n\r\nKlein is deeply indebted to several members of the GA community and their work. Beyond the works\r\ncited here, the author stands of the shoulders of giants (Felix _Klein_, Sophus Lie, Arthur Cayley,\r\nWilliam Rowan Hamilton, Julius Plücker, and William Kingdon Clifford, among others).\r\n\r\n\u003ca id=\"1\"\u003e[1]\u003c/a\u003e\r\nGunn, Charles G. (2019).\r\nCourse notes Geometric Algebra for Computer Graphics, SIGGRAPH 2019.\r\n[arXiv link](https://arxiv.org/abs/2002.04509)\r\n\r\n\u003ca id=\"2\"\u003e[2]\u003c/a\u003e\r\nSteven De Keninck and Charles Gunn. (2019).\r\nSIGGRAPH 2019 Geometric Algebra Course.\r\n[youtube link](https://www.youtube.com/watch?v=tX4H_ctggYo)\r\n\r\n\u003ca id=\"3\"\u003e[3]\u003c/a\u003e\r\nLeo Dorst, Daniel Fontijne, Stephen Mann. (2007)\r\nGeometric Algebra for Computer Science.\r\nBurlington, MA: Morgan Kaufmann Publishers Inc.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyong%2Fklein","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjeremyong%2Fklein","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjeremyong%2Fklein/lists"}