Skip to main content

derive_null_constraint

Function derive_null_constraint 

Source
pub fn derive_null_constraint(
    grades: &[usize],
    algebra: &Algebra,
) -> Vec<String>
Expand description

Derives the null constraint expression for a grade combination.

A null element has zero norm: v * ṽ = 0. This function derives the constraint equations that must hold for an element to be null.

In CGA, points are null vectors (grade 1 with v * ṽ = 0). This constraint is essential for representing actual geometric points vs general vectors.

§Arguments

  • grades - The grades present in the type
  • algebra - The algebra definition

§Returns

A vector of constraint expressions. For the null constraint, this includes:

  • The scalar part of v * ṽ must be zero
  • Any non-scalar parts must also be zero (same as versor constraint)

§Example

use clifford_codegen::discovery::derive_null_constraint;
use clifford_codegen::algebra::Algebra;

// CGA point (grade 1) needs null constraint
let algebra = Algebra::new(4, 1, 0); // Cl(4,1,0)
let constraints = derive_null_constraint(&[1], &algebra);
// Returns constraint that x² + y² + z² + w² - u² = 0 (null vector)