Skip to main content

Rotor

Struct Rotor 

Source
pub struct Rotor<T> {
    pub scalar: T,
    pub xy: T,
    pub xz: T,
    pub yz: T,
}
Expand description

The 3D rotor type.

Fields§

§scalar: T

The scalar component.

§xy: T

The component representing the xy plane.

§xz: T

The component representing the xz plane.

§yz: T

The component representing the yz plane.

Implementations§

Source§

impl<T> Rotor<T>

Source

pub fn new(scalar: T, xy: T, xz: T, yz: T) -> Self

Creates a new rotor from its components.

Source§

impl<T: Real> Rotor<T>

Source

pub fn rotate(self, vector: Vector<T>) -> Vector<T>

Rotates a vector by the rotor.

Source

pub fn rotate_normalized(self, v: Vector<T>) -> Vector<T>

Rotates a vector by the rotor using the sandwich product R v R†. The rotor has to be normalized already.

Source

pub fn rotate_bivector(self, bivector: Bivector<T>) -> Bivector<T>

Rotates a bivector by the rotor.

Source

pub fn rotate_bivector_normalized(self, b: Bivector<T>) -> Bivector<T>

Rotates a bivector by the rotor using the sandwich product R B R†. The rotor has to be normalized already.

Source

pub fn reverse(self) -> Self

The reverse of the rotor.

Source§

impl<T: Zero> Rotor<T>

Source

pub fn scalar(scalar: T) -> Self

Creates a new scalar rotor.

Source

pub fn xy(xy: T) -> Self

Creates a new rotor along the xy plane.

Source

pub fn xz(xz: T) -> Self

Creates a new rotor along the xz plane.

Source

pub fn yz(yz: T) -> Self

Creates a new rotor along the yz plane.

Trait Implementations§

Source§

impl<T> Add for Rotor<T>
where T: Add<Output = T>,

Source§

type Output = Rotor<T>

The resulting type after applying the + operator.
Source§

fn add(self, __rhs: Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> AddAssign for Rotor<T>
where T: AddAssign,

Source§

fn add_assign(&mut self, __rhs: Self)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for Rotor<T>

Source§

fn clone(&self) -> Rotor<T>

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<T: Debug> Debug for Rotor<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T: Display> Display for Rotor<T>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<T> Div<T> for Rotor<T>
where T: Div<Output = T> + Copy,

Source§

type Output = Rotor<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: T) -> Self

Performs the / operation. Read more
Source§

impl<T: Real> Div for Rotor<T>

Source§

type Output = Rotor<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: Self) -> Self

Performs the / operation. Read more
Source§

impl<T> DivAssign<T> for Rotor<T>
where T: DivAssign + Copy,

Source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
Source§

impl<T: Real> DivAssign for Rotor<T>

Source§

fn div_assign(&mut self, other: Self)

Performs the /= operation. Read more
Source§

impl<T: Real> DotProduct<Bivector<T>> for Rotor<T>

Source§

type Output = Rotor<T>

The output type of the dot product.
Source§

fn dot(&self, other: &Bivector<T>) -> Self

The dot product (contraction).
Source§

fn scalar(&self, other: &T) -> Self::Output

The scalar product (positive-definite). Read more
Source§

impl<T: Real> DotProduct<Rotor<T>> for Bivector<T>

Source§

type Output = Rotor<T>

The output type of the dot product.
Source§

fn dot(&self, other: &Rotor<T>) -> Rotor<T>

The dot product (contraction).
Source§

fn scalar(&self, other: &T) -> Self::Output

The scalar product (positive-definite). Read more
Source§

impl<T: Real> DotProduct<Rotor<T>> for Vector<T>

Source§

type Output = Vector<T>

The output type of the dot product.
Source§

fn dot(&self, other: &Rotor<T>) -> Self

The dot product (contraction).
Source§

fn scalar(&self, other: &T) -> Self::Output

The scalar product (positive-definite). Read more
Source§

impl<T: Real> DotProduct<Vector<T>> for Rotor<T>

Source§

type Output = Vector<T>

The output type of the dot product.
Source§

fn dot(&self, other: &Vector<T>) -> Vector<T>

The dot product (contraction).
Source§

fn scalar(&self, other: &T) -> Self::Output

The scalar product (positive-definite). Read more
Source§

impl<T: Real> DotProduct for Rotor<T>

Source§

type Output = <Rotor<T> as VectorSpace>::Scalar

The output type of the dot product.
Source§

fn dot(&self, other: &Self) -> T

The dot product (contraction).
Source§

fn scalar(&self, other: &Self) -> T

The scalar product (positive-definite). Read more
Source§

impl<T: Real> From<T> for Rotor<T>

Source§

fn from(scalar: T) -> Self

Converts to this type from the input type.
Source§

impl<T: FromStr> FromStr for Rotor<T>

Source§

type Err = ParseRotorError

The associated error which can be returned from parsing.
Source§

fn from_str(source: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. Read more
Source§

impl<T: Real> Inv for Rotor<T>

Source§

type Output = Rotor<T>

Source§

fn inv(self) -> Self

Source§

impl<T> Mul<T> for Rotor<T>
where T: Mul<Output = T> + Copy,

Source§

type Output = Rotor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: T) -> Self

Performs the * operation. Read more
Source§

impl<T: Real> Mul for Rotor<T>

Source§

type Output = Rotor<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: Self) -> Self

Performs the * operation. Read more
Source§

impl<T> MulAssign<T> for Rotor<T>
where T: MulAssign + Copy,

Source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
Source§

impl<T: Real> MulAssign for Rotor<T>

Source§

fn mul_assign(&mut self, other: Self)

Performs the *= operation. Read more
Source§

impl<T: Neg<Output = T>> Neg for Rotor<T>

Source§

type Output = Rotor<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Rotor<T>

Performs the unary - operation. Read more
Source§

impl<T: Real> One for Rotor<T>

Source§

fn one() -> Self

Source§

fn is_one(&self) -> bool

Source§

impl<T: PartialEq> PartialEq for Rotor<T>

Source§

fn eq(&self, other: &Rotor<T>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T> Sub for Rotor<T>
where T: Sub<Output = T>,

Source§

type Output = Rotor<T>

The resulting type after applying the - operator.
Source§

fn sub(self, __rhs: Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign for Rotor<T>
where T: SubAssign,

Source§

fn sub_assign(&mut self, __rhs: Self)

Performs the -= operation. Read more
Source§

impl<T: Real> Transform<Bivector<T>> for Rotor<T>

Source§

fn apply_point(&self, bivector: Bivector<T>) -> Bivector<T>

Applies this transformation to a point.
Source§

impl<T: Real> Transform<Vector<T>> for Rotor<T>

Source§

fn apply_point(&self, point: Vector<T>) -> Vector<T>

Applies this transformation to a point.
Source§

impl<T: Real> VectorSpace for Rotor<T>

Source§

type Scalar = T

The scalar type of the vector space.
Source§

impl<T: Zero> Zero for Rotor<T>

Source§

fn zero() -> Self

Source§

fn is_zero(&self) -> bool

Source§

impl<T: Copy> Copy for Rotor<T>

Source§

impl<T: Eq> Eq for Rotor<T>

Source§

impl<T> StructuralPartialEq for Rotor<T>

Auto Trait Implementations§

§

impl<T> Freeze for Rotor<T>
where T: Freeze,

§

impl<T> RefUnwindSafe for Rotor<T>
where T: RefUnwindSafe,

§

impl<T> Send for Rotor<T>
where T: Send,

§

impl<T> Sync for Rotor<T>
where T: Sync,

§

impl<T> Unpin for Rotor<T>
where T: Unpin,

§

impl<T> UnsafeUnpin for Rotor<T>
where T: UnsafeUnpin,

§

impl<T> UnwindSafe for Rotor<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T, D> AffineSpace for T
where T: Sub<Output = D>, D: VectorSpace,

Source§

type Diff = D

The difference type.
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> Bases for T
where T: VectorSpace,

Source§

fn unit_bases<const I: usize>() -> Self
where Self: Basis<I>,

Creates the specified unit basis of the vector space.
Source§

fn bases_of<const I: usize>(magnitude: Self::Scalar) -> Self
where Self: Basis<I>,

Creates the specified basis of the vector of the specified magnitude.
Source§

fn bases<const I: usize>(&self) -> Self::Scalar
where Self: Basis<I>,

Queries the specified basis of a vector space.
Source§

fn bases_mut<const I: usize>(&mut self) -> &mut Self::Scalar
where Self: Basis<I>,

Queries the specified basis of a vector space as a mutable reference.
Source§

fn with_bases<const I: usize>(self, magnitude: Self::Scalar) -> Self
where Self: Basis<I>,

Creates a new vector with the specified basis set to a different value.
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> InnerSpace for T
where T: DotProduct<Output = <T as VectorSpace>::Scalar>,

Source§

fn magnitude2(&self) -> Self::Scalar

The squared magnitude. Read more
Source§

fn magnitude(&self) -> Self::Scalar

The magnitude of a vector.
Source§

fn normalize(self) -> Self

The normalized vector.
Source§

fn angle(&self, other: &Self) -> Self::Scalar

The angle between two vectors.
Source§

fn with_magnitude(self, magnitude: Self::Scalar) -> Self

Sets the magnitude of a vector.
Source§

fn with_direction(self, dir: Self) -> Self

Sets the direction of a vector.
Source§

fn query_axis(&self, dir: Self) -> Self::Scalar

The value of the vector along the specified axis.
Source§

fn normalized_project(self, dir: Self) -> Self

Projects a vector onto an already normalized direction vector.
Source§

fn project(self, dir: Self) -> Self

Projects a vector onto the specified direction vector.
Source§

fn normalized_reject(self, dir: Self) -> Self

Rejects a vector from an already normalized direction vector.
Source§

fn reject(self, dir: Self) -> Self

Rejects a vector from the specified direction vector.
Source§

fn normalized_reflect(self, dir: Self) -> Self

Reflects a vector from an already normalized direction vector.
Source§

fn reflect(self, dir: Self) -> Self

Reflects a vector from the specified direction vector.
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.
Source§

impl<T> Numeric for T
where T: Add<Output = T> + Sub<Output = T> + Copy + Mul<Output = T> + PartialEq + Zero + One,

Source§

impl<T> VectorSpaceAssign for T