ga2
2D geometric algebra types for Rust.
Types
Vector<T>- 2D vector withx,ycomponentsBivector<T>- 2D bivector withxycomponentRotor<T>- 2D rotor withscalar,xycomponents (rotation operator)Point<T>- 2D affine point withx,ycomponents
Features
- Full arithmetic on all types (add, sub, mul, div, neg)
- Geometric product:
Vector * Vector -> Rotor - Wedge product:
Vector::wedge(other) -> Bivector - Rotor rotation via sandwich product
Rotorimplementsvector_space::Transform<Vector<T>>Point - Point -> Vector(AffineSpace)Display/FromStrfor all typesVectorSpace,DotProduct,InnerSpacetrait integrationBasis<0>,Basis<1>for component access- Optional serialization via
data-streamfeature - Optional parsing via
parsablefeature
Example
use ;
let a = new;
let b = new;
let displacement: = b - a;
let rotor = x * y;
let rotated = rotor.rotate;
AI-assisted development
This crate is designed for use with AI coding assistants. Consistent trait implementations across all types, no implicit behavior, Display/FromStr on all public types, and standard VectorSpace/InnerSpace trait integration make it straightforward for AI to work with.