Skip to main content

versorc_math/versor/
mod.rs

1// ============================================================================
2// VERSORC-MATH: THE VERSOR GROUP & SANDWICH OPERATORS
3// License: Apache-2.0
4// ============================================================================
5
6pub mod hamilton;
7pub mod dual_quaternion;
8pub mod rotor;
9pub mod householder;
10pub mod dyadic;
11pub mod planar_bank;
12
13pub use hamilton::Quaternion;
14pub use dual_quaternion::DualQuaternion;
15pub use rotor::PlanarRotor;
16pub use householder::{HouseholderVersor, HouseholderChain};
17pub use dyadic::DyadicWalshVersor;
18pub use planar_bank::PlanarSpinorBank;
19
20/// Trait defining the two-sided sandwich action of a Versor: x |-> V * x * V~.
21pub trait VersorAction<T: ?Sized> {
22    /// Applies the versor sandwich transformation in-place: x = V * x * V~.
23    fn transform_in_place(&self, target: &mut T);
24
25    /// Applies the versor sandwich transformation out-of-place.
26    fn transform(&self, target: &T) -> T
27    where
28        T: Clone + Sized,
29    {
30        let mut copy = target.clone();
31        self.transform_in_place(&mut copy);
32        copy
33    }
34}