pub struct Rotor { /* private fields */ }Expand description
A rotor represents a rotation in geometric algebra.
Rotors are even-grade multivectors with unit magnitude that implement rotations via the sandwich product: R v R†
In 3D, a rotor encodes rotation by angle θ around an axis n as: R = cos(θ/2) + sin(θ/2) * B where B is the unit bivector representing the rotation plane.
Implementations§
Source§impl Rotor
impl Rotor
Sourcepub fn from_multivector(mv: GA3) -> Self
pub fn from_multivector(mv: GA3) -> Self
Create a rotor from a multivector (assumes it’s already a valid rotor)
Sourcepub fn xy(angle: f64) -> Self
pub fn xy(angle: f64) -> Self
Create a rotor for rotation by angle (in radians) in the XY plane
This is equivalent to rotation around the Z axis.
Sourcepub fn xz(angle: f64) -> Self
pub fn xz(angle: f64) -> Self
Create a rotor for rotation by angle (in radians) in the XZ plane
This is equivalent to rotation around the Y axis.
Sourcepub fn yz(angle: f64) -> Self
pub fn yz(angle: f64) -> Self
Create a rotor for rotation by angle (in radians) in the YZ plane
This is equivalent to rotation around the X axis.
Sourcepub fn from_bivector_angle(angle: f64, xy: f64, xz: f64, yz: f64) -> Self
pub fn from_bivector_angle(angle: f64, xy: f64, xz: f64, yz: f64) -> Self
Create a rotor from an angle and bivector components
The bivector (xy, xz, yz) defines the rotation plane. Components are normalized internally.
Sourcepub fn from_axis_angle(
axis_x: f64,
axis_y: f64,
axis_z: f64,
angle: f64,
) -> Self
pub fn from_axis_angle( axis_x: f64, axis_y: f64, axis_z: f64, angle: f64, ) -> Self
Create a rotor for rotation around an axis vector by an angle
The axis does not need to be normalized.
Sourcepub fn as_multivector(&self) -> &GA3
pub fn as_multivector(&self) -> &GA3
Get the internal multivector
Sourcepub fn transform(&self, v: &GA3) -> GA3
pub fn transform(&self, v: &GA3) -> GA3
Apply this rotor to transform a multivector (sandwich product)
Returns R * v * R†
Sourcepub fn then(&self, other: &Rotor) -> Rotor
pub fn then(&self, other: &Rotor) -> Rotor
Compose two rotors: self followed by other
The result applies self first, then other.
Sourcepub fn to_amari_rotor(&self) -> AmariRotor<3, 0, 0>
pub fn to_amari_rotor(&self) -> AmariRotor<3, 0, 0>
Convert to an amari-core Rotor<3,0,0>
This enables interop with amari-core’s typed rotor operations (slerp, compose, logarithm, power, etc.)
Sourcepub fn from_amari_rotor(rotor: &AmariRotor<3, 0, 0>) -> Self
pub fn from_amari_rotor(rotor: &AmariRotor<3, 0, 0>) -> Self
Create from an amari-core Rotor<3,0,0>