Klein

Klein

License: MIT DOI Build Status Build Status Coverity Status Codacy Badge

Do you need to do any of the following? Quickly? Really quickly even?

  • Projecting points onto lines, lines to planes, points to planes?
  • Measuring distances and angles between points, lines, and planes?
  • Rotate or translate points, lines, and planes?
  • Perform smooth rigid body transforms? Interpolate them smoothly?
  • Construct lines from points? Planes from points? Planes from a line and a point?
  • Intersect planes to form lines? Intersect a planes and lines to form points?

If so, then Klein is the library for you!

Feature Summary

Klein is an implementation of \(\mathbf{P}(\mathbb{R}^*_{3, 0, 1})\), aka 3D Projective Geometric Algebra. It is designed for applications that demand high-throughput (animation libraries, kinematic solvers, etc). In contrast to other GA libraries, Klein does not attempt to generalize the metric or dimensionality of the space. In exchange for this loss of generality, Klein implements the algebraic operations using the full weight of SSE (Streaming SIMD Extensions) for maximum throughput. Klein's performance is fully competitive with state of the art kinematic and math libraries built with traditional vector and quaternion formulations.

Tip

Knowledge of Geometric Algebra is NOT required to benefit from the library, but familiarity can ease the learning curve of the API somewhat, as the operators in Geometric Algebra map cleanly to geometric operations.

  • Geometric computing library suitable for use with realtime graphics and animation applications
  • Header-only core libary with an optional lightweight symbolic computer algebra system
  • SSE3 or SSE4.1-optimized implementations
  • Tested on Linux, MacOS, and Windows
  • Requires no third-party dependencies
  • Permissively licensed

Frequently tested compilers

  • GCC 9.2.1 on Linux
  • Clang 9.0.1 on Linux
  • Visual Studio 2019 on Windows 10
  • Xcode 11.3 on MacOS

Supported entities

  • Points
  • Directions
  • Lines
  • Ideal lines
  • Planes
  • Rotors
  • Translators
  • Motors

Supported operations

  • Geometric product (used to compose group actions)
  • Exterior product (used to meet entities)
  • Regressive product (used to join entities)
  • Conjugation (aka "sandwich") operators (defined via the call operator on planes, rotors, translators, and motors)
  • Inner product (used for metric measurements and to project entities)
  • Standard arithmetic operations
  • Motor logarithm to compute the motor axis
  • Line exponentiation to generate motors
  • Rotor logarithm to compute the rotor axis (also referred to as a branch)
  • Branch exponentiation to generate rotors

The spherical interpolation operation "slerp" can be implemented easily in terms of the rotor or motor logarithm, depending on what is needed.