ga2 0.6.2

Common types for 2D geometric algebra
Documentation

ga2

2D geometric algebra types for Rust.

Types

  • Vector<T> - 2D vector with x, y components
  • Bivector<T> - 2D bivector with xy component
  • Rotor<T> - 2D rotor with scalar, xy components (rotation operator)
  • Point<T> - 2D affine point with x, y components

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
  • Rotor implements vector_space::Transform<Vector<T>>
  • Point - Point -> Vector (AffineSpace)
  • Display/FromStr for all types
  • VectorSpace, DotProduct, InnerSpace trait integration
  • Basis<0>, Basis<1> for component access
  • Optional serialization via data-stream feature
  • Optional parsing via parsable feature

Example

use ga2::{Vector, Point};

let a = Point::new(1.0, 2.0);
let b = Point::new(4.0, 6.0);
let displacement: Vector<f32> = b - a;

let rotor = Vector::x(1.0) * Vector::y(1.0);
let rotated = rotor.rotate(Vector::new(1.0, 0.0));

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.