geoit 0.0.2

Exact geometric algebra with governed multivectors
Documentation
//! Create a CGA point using the algebra family registry.
//!
//! Run: `cargo run --example cga_point`

use geoit::governance;
use geoit::*;

fn main() {
    // One call: complete CGA(2) governance with classes, constructions, constraints
    let gov = standard_registry().instantiate_family("CGA", 2).unwrap();
    println!("CGA(2) signature: {}", gov.sig);
    println!(
        "Classes: {}, Constructions: {}",
        gov.geom_classes.len(),
        gov.constructions.len()
    );

    // Construct a conformal point at (3, 4)
    let point_mv = gov
        .construct(0, &[Scalar::from(3), Scalar::from(4)])
        .unwrap();

    // Govern: verify it satisfies the CGA point class (null, normalized)
    let geoit = governance::govern(&point_mv, &gov, 0).unwrap();
    println!("Satisfied: {}", geoit.is_satisfied());
    println!("Phase: {:?}", geoit.phase());
    println!("Profile: {}", geoit.profile());

    // Read back construction parameters
    let params = geoit.read_all().unwrap();
    println!("Extracted params: {:?}", params);
    assert_eq!(params, vec![Scalar::from(3), Scalar::from(4)]);

    // Works at any dimension
    let gov3 = standard_registry().instantiate_family("CGA", 3).unwrap();
    let p3 = gov3
        .construct(0, &[Scalar::from(1), Scalar::from(2), Scalar::from(3)])
        .unwrap();
    let g3 = governance::govern(&p3, &gov3, 0).unwrap();
    println!("CGA(3) point governed: {}", g3.is_satisfied());
}