Skip to main content

Rotor

Struct Rotor 

Source
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

Source

pub fn from_multivector(mv: GA3) -> Self

Create a rotor from a multivector (assumes it’s already a valid rotor)

Source

pub fn identity() -> Self

Create the identity rotor (no rotation)

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

pub fn as_multivector(&self) -> &GA3

Get the internal multivector

Source

pub fn transform(&self, v: &GA3) -> GA3

Apply this rotor to transform a multivector (sandwich product)

Returns R * v * R†

Source

pub fn then(&self, other: &Rotor) -> Rotor

Compose two rotors: self followed by other

The result applies self first, then other.

Source

pub fn inverse(&self) -> Rotor

Get the inverse rotor (reverse rotation)

Source

pub fn normalize(&self) -> Rotor

Normalize the rotor to unit magnitude

Source

pub fn angle(&self) -> f64

Get the rotation angle (in radians)

Source

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.)

Source

pub fn from_amari_rotor(rotor: &AmariRotor<3, 0, 0>) -> Self

Create from an amari-core Rotor<3,0,0>

Source

pub fn slerp(&self, t: f64) -> Rotor

Spherical linear interpolation between identity and this rotor

t=0 gives identity, t=1 gives self

Source

pub fn slerp_to(&self, other: &Rotor, t: f64) -> Rotor

Spherical linear interpolation between two rotors

Trait Implementations§

Source§

impl Clone for Rotor

Source§

fn clone(&self) -> Rotor

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Rotor

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl Freeze for Rotor

§

impl RefUnwindSafe for Rotor

§

impl Send for Rotor

§

impl Sync for Rotor

§

impl Unpin for Rotor

§

impl UnsafeUnpin for Rotor

§

impl UnwindSafe for Rotor

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.