pub struct GeometricState { /* private fields */ }Expand description
State that lives in geometric space with explicit transformation support.
Unlike Behavior<T>, which hides the geometric representation,
GeometricState exposes it directly. This is useful for:
- Animation with geometric interpolation (SLERP)
- Physics simulations
- Explicit rotation/translation control
- Advanced users who understand geometric algebra
Implementations§
Source§impl GeometricState
impl GeometricState
Sourcepub fn from_scalar(value: f64) -> Self
pub fn from_scalar(value: f64) -> Self
Create state representing a scalar value
Sourcepub fn from_vector(x: f64, y: f64, z: f64) -> Self
pub fn from_vector(x: f64, y: f64, z: f64) -> Self
Create state representing a 3D vector/position
Sourcepub fn from_bivector(xy: f64, xz: f64, yz: f64) -> Self
pub fn from_bivector(xy: f64, xz: f64, yz: f64) -> Self
Create state representing a bivector (rotation plane)
Sourcepub fn from_coefficients(coeffs: Vec<f64>) -> Self
pub fn from_coefficients(coeffs: Vec<f64>) -> Self
Create state from raw coefficients
Sourcepub fn multivector(&self) -> GA3
pub fn multivector(&self) -> GA3
Get the underlying multivector (cloned)
Sourcepub fn as_typed_vector(&self) -> Vector<3, 0, 0>
pub fn as_typed_vector(&self) -> Vector<3, 0, 0>
Get the vector components as a typed Vector<3,0,0>
Sourcepub fn as_bivector(&self) -> (f64, f64, f64)
pub fn as_bivector(&self) -> (f64, f64, f64)
Get the bivector components (e12, e13, e23) as a tuple
Sourcepub fn as_typed_bivector(&self) -> Bivector<3, 0, 0>
pub fn as_typed_bivector(&self) -> Bivector<3, 0, 0>
Get the bivector components as a typed Bivector<3,0,0>
Sourcepub fn project<P: Projection>(&self, projection: &P) -> P::Output
pub fn project<P: Projection>(&self, projection: &P) -> P::Output
Project using a projection type
Sourcepub fn set_scalar(&self, value: f64)
pub fn set_scalar(&self, value: f64)
Set the scalar value
Sourcepub fn set_vector(&self, x: f64, y: f64, z: f64)
pub fn set_vector(&self, x: f64, y: f64, z: f64)
Set the vector value from components
Sourcepub fn set_typed_vector(&self, v: &Vector<3, 0, 0>)
pub fn set_typed_vector(&self, v: &Vector<3, 0, 0>)
Set the vector value from a typed Vector<3,0,0>
Sourcepub fn set_typed_bivector(&self, b: &Bivector<3, 0, 0>)
pub fn set_typed_bivector(&self, b: &Bivector<3, 0, 0>)
Set the bivector value from a typed Bivector<3,0,0>
Sourcepub fn apply_rotor(&self, rotor: &Rotor) -> GeometricState
pub fn apply_rotor(&self, rotor: &Rotor) -> GeometricState
Apply a rotor transformation (rotation)
This creates a new state; the original is unchanged.
Sourcepub fn apply_rotor_mut(&self, rotor: &Rotor)
pub fn apply_rotor_mut(&self, rotor: &Rotor)
Apply a rotor transformation in-place
Sourcepub fn apply_translation(&self, translation: &Translation) -> GeometricState
pub fn apply_translation(&self, translation: &Translation) -> GeometricState
Apply a translation
This creates a new state; the original is unchanged.
Sourcepub fn apply_translation_mut(&self, translation: &Translation)
pub fn apply_translation_mut(&self, translation: &Translation)
Apply a translation in-place
Sourcepub fn apply_versor(&self, versor: &Versor) -> GeometricState
pub fn apply_versor(&self, versor: &Versor) -> GeometricState
Apply a versor transformation
This creates a new state; the original is unchanged.
Sourcepub fn apply_versor_mut(&self, versor: &Versor)
pub fn apply_versor_mut(&self, versor: &Versor)
Apply a versor transformation in-place
Sourcepub fn apply_transform(&self, transform: &Transform) -> GeometricState
pub fn apply_transform(&self, transform: &Transform) -> GeometricState
Apply a general transform (rotation + translation)
This creates a new state; the original is unchanged.
Sourcepub fn apply_transform_mut(&self, transform: &Transform)
pub fn apply_transform_mut(&self, transform: &Transform)
Apply a general transform in-place
Sourcepub fn add(&self, other: &GeometricState) -> GeometricState
pub fn add(&self, other: &GeometricState) -> GeometricState
Add another state (geometric addition)
Sourcepub fn sub(&self, other: &GeometricState) -> GeometricState
pub fn sub(&self, other: &GeometricState) -> GeometricState
Subtract another state
Sourcepub fn scale(&self, factor: f64) -> GeometricState
pub fn scale(&self, factor: f64) -> GeometricState
Scale by a scalar value
Sourcepub fn geometric_product(&self, other: &GeometricState) -> GeometricState
pub fn geometric_product(&self, other: &GeometricState) -> GeometricState
Geometric product with another state
Sourcepub fn normalize(&self) -> Option<GeometricState>
pub fn normalize(&self) -> Option<GeometricState>
Normalize the state to unit magnitude
Sourcepub fn normalize_mut(&self) -> bool
pub fn normalize_mut(&self) -> bool
Normalize in-place
Sourcepub fn reverse(&self) -> GeometricState
pub fn reverse(&self) -> GeometricState
Get the reverse (reversion) of this state
Sourcepub fn lerp(&self, other: &GeometricState, t: f64) -> GeometricState
pub fn lerp(&self, other: &GeometricState, t: f64) -> GeometricState
Linear interpolation to another state
Sourcepub fn slerp(&self, other: &GeometricState, t: f64) -> GeometricState
pub fn slerp(&self, other: &GeometricState, t: f64) -> GeometricState
Spherical linear interpolation (for rotor-like states)
This assumes both states are unit rotors.
Trait Implementations§
Source§impl Clone for GeometricState
impl Clone for GeometricState
Source§fn clone(&self) -> GeometricState
fn clone(&self) -> GeometricState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more