Skip to content

E1: Conformal Geometric Algebra (CGA)

Module: sci_form::experimental::cgaFeature flag: experimental-cga


Overview

Replaces the internal geometry engine (separate quaternions + vectors) with Conformal Geometric Algebra G(4,1), unifying rotations and translations into a single multiplicative operator called a Motor (MXM~). This eliminates gimbal lock and enables massively parallelizable geometric operations for conformer generation and MOF assembly.


Theory

G(4,1) Multivector

The conformal model embeds 3D Euclidean space into a 5D space with signature (4,1):

e12=e22=e32=e+2=1,e2=1

A general multivector has 25=32 components spanning all grade combinations. The geometric product encodes both the inner and outer products:

ab=ab+ab

Motors

A Motor is the composition of a rotor (rotation) and translator:

  • Rotor: R=cos(θ/2)sin(θ/2)L^
  • Translator: T=112te
  • Motor: M=TR

Objects transform via the sandwich product X=MXM~.

Point Embedding

3D coordinates lift to conformal points:

P=p+12|p|2e+eo

Coordinates are recovered from the transformed multivector by extracting the Euclidean components and normalizing.


API

rust
use sci_form::experimental::cga::*;

// Multivector operations
let a = Multivector::basis(1);           // e₁
let b = Multivector::basis(2);           // e₂
let ab = a.geometric_product(&b);        // e₁e₂
let rev = ab.reverse();                  // ẽ₁₂ = e₂e₁

// Motor from axis-angle
let motor = Motor::from_axis_angle([0.0, 0.0, 1.0], std::f64::consts::FRAC_PI_2);

// Transform a point
let point = cga_point([1.0, 0.0, 0.0]);
let rotated = motor.apply(&point);
let coords = extract_point(&rotated);   // ≈ [0, 1, 0]

// Dihedral rotation
let dihedral_motor = Motor::dihedral([0.0, 0.0, 0.0], [1.0, 0.0, 0.0], 1.047);

Applications

  • Conformer generation: Dihedral torsion scans using CGA motors instead of rotation matrices
  • MOF assembly: Unit cell lattice vectors as translation motors, SBU placement via motor composition
  • Supercell construction: Motor exponentiation Msuper=Mcellnanbnc

Tests

bash
cargo test --features experimental-cga --test regression -- test_cga

Covers: multivector algebra, motor construction, point embedding round-trips, dihedral rotations, and materials assembly comparison.

Released under the MIT License.