#gamedev-physics #2d #vector-math #gamedev #physics

sp2

2D spatial transforms and movement representations using geometric algebra

3 releases (breaking)

Uses new Rust 2024

0.3.0 Jan 17, 2026
0.2.0 Oct 14, 2022
0.1.0 Oct 9, 2022

#2179 in Math

MIT/Apache

11KB
240 lines

SP2 - 2D Spatial Transforms

A minimal library for 2D spatial transformations using geometric algebra. Provides Transform (translation, orientation) and Movement (velocity, rotation) types with full operator support.


SP2 - 2D Spatial Transforms

Crates.io Docs License

Minimal 2D spatial transforms using geometric algebra.

Features

  • Transform: Translation and orientation with full operator support
  • Movement: Velocity and rotation representation
  • Geometric algebra-based operations

Example

use ga2::{Bivector, Vector};
use sp2::{Movement, Transform};

let mut transform = Transform {
    translation: Vector::new(1.0, 2.0),
    orientation: Vector::x(1.0) * Vector::y(1.0),
};

let movement = Movement {
    velocity: Vector::new(-1.0, 0.0),
    rotation: Bivector::new(1.0),
};

transform += movement;

assert_eq!(transform.translation, Vector::new(0.0, 2.0));

Dependencies

~0.9–1.4MB
~29K SLoC