ga3 0.3.4

Common types for 3D geometric algebra
Documentation

ga3

3D geometric algebra types for Rust.

Types

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

Features

  • Full arithmetic on all types (add, sub, mul, div, neg)
  • Geometric product: Vector * Vector -> Rotor
  • Wedge product: Vector::wedge(other) -> Bivector
  • Cross product: Vector::cross(other) -> Vector
  • 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>, Basis<2> for component access
  • Optional serialization via data-stream feature
  • Optional parsing via parsable feature

Example

use ga3::{Bivector, Vector, Point};

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

let rotor = Bivector::xy(std::f32::consts::FRAC_PI_4).exp();
let rotated = rotor.rotate(Vector::new(1.0, 0.0, 0.0));

let normal = Vector::x(1.0).cross(Vector::y(1.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.