PureQuaternion

Struct PureQuaternion 

Source
pub struct PureQuaternion<T> {
    pub x: T,
    pub y: T,
    pub z: T,
}
Expand description

A pure quaternion, i.e. a quaternion with a real part of zero.

A pure quaternion is a quaternion of the form $bi + cj + dk$. Computations with pure quaternions can be more efficient than with general quaternions. Apart from that, pure quaternions are used to represent 3D vectors and provide the compile-time guarantee that the real part is zero.

The PureQuaternion struct is kept as similar as possible to the [Quaternion] struct with respect to its API. It provides

  • a constructor PureQuaternion::new to create a new pure quaternion,
  • member data fields x, y, and z to access the coefficients of $i$, $j$, and $k$, respectively,
  • The types aliases PQ32 and PQ64 are provided for PureQuaternion<f32> and PureQuaternion<f64>, respectively.

Fields§

§x: T

The coefficient of $i$.

§y: T

The coefficient of $j$.

§z: T

The coefficient of $k$.

Implementations§

Source§

impl<T> PureQuaternion<T>

Source

pub const fn new(x: T, y: T, z: T) -> Self

Constructs a new pure quaternion.

§Examples
let q = PureQuaternion::new(1.0, 2.0, 3.0);
Source§

impl<T> PureQuaternion<T>
where T: ConstZero,

Source

pub const ZERO: Self

Constructs a new pure quaternion with all components set to zero.

§Examples
let q = PureQuaternion::ZERO;
assert_eq!(q, PureQuaternion::new(0.0, 0.0, 0.0));
Source§

impl<T> PureQuaternion<T>
where T: ConstZero + ConstOne,

Source

pub const I: Self

A constant PureQuaternion of value $i$.

See also Quaternion::I, PureQuaternion::i.

§Example
let q = PureQuaternion::I;
assert_eq!(q, PureQuaternion::new(1.0, 0.0, 0.0));
Source

pub const J: Self

A constant PureQuaternion of value $j$.

See also Quaternion::J, PureQuaternion::j.

§Example
let q = PureQuaternion::J;
assert_eq!(q, PureQuaternion::new(0.0, 1.0, 0.0));
Source

pub const K: Self

A constant PureQuaternion of value $k$.

See also Quaternion::K, PureQuaternion::k.

§Example
let q = PureQuaternion::K;
assert_eq!(q, PureQuaternion::new(0.0, 0.0, 1.0));
Source§

impl<T> PureQuaternion<T>
where T: Zero + One,

Source

pub fn i() -> Self

Returns the imaginary unit $i$.

See also Quaternion::i, PureQuaternion::I.

§Example
let q = PureQuaternion::i();
assert_eq!(q, PureQuaternion::new(1.0, 0.0, 0.0));
Source

pub fn j() -> Self

Returns the imaginary unit $j$.

See also Quaternion::j, PureQuaternion::J.

§Example
let q = PureQuaternion::j();
assert_eq!(q, PureQuaternion::new(0.0, 1.0, 0.0));
Source

pub fn k() -> Self

Returns the imaginary unit $k$.

See also Quaternion::k, PureQuaternion::K.

§Example
let q = PureQuaternion::k();
assert_eq!(q, PureQuaternion::new(0.0, 0.0, 1.0));
Source§

impl<T> PureQuaternion<T>
where T: Float,

Source

pub fn nan() -> Self

Returns a pure quaternion filled with NaN values.

§Example
let q = PQ32::nan();
assert!(q.x.is_nan());
assert!(q.y.is_nan());
assert!(q.z.is_nan());
Source§

impl<T> PureQuaternion<T>
where T: Clone + Mul<T, Output = T> + Add<T, Output = T>,

Source

pub fn norm_sqr(&self) -> T

Returns the square of the norm.

The result is $x^2 + y^2 + z^2$ with some rounding errors. The rounding error is at most 2 ulps.

This is guaranteed to be more efficient than norm. Furthermore, T only needs to support addition and multiplication and therefore, this function works for more types than norm.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
assert_eq!(q.norm_sqr(), 14.0);
Source§

impl<T> PureQuaternion<T>
where T: Clone + Neg<Output = T>,

Source

pub fn conj(&self) -> Self

Returns the conjugate of the pure quaternion, i. e. its negation.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
assert_eq!(q.conj(), PureQuaternion::new(-1.0, -2.0, -3.0));
Source§

impl<T> PureQuaternion<T>
where for<'a> &'a Self: Inv<Output = PureQuaternion<T>>,

Source

pub fn inv(&self) -> Self

Returns the inverse of the pure quaternion.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
assert_eq!(q.inv(), PureQuaternion::new(
    -1.0 / 14.0, -2.0 / 14.0, -3.0 / 14.0));
Source§

impl<T> PureQuaternion<T>
where T: Float,

Source

pub fn norm(self) -> T

Calculates |self|.

The result is $\sqrt{x^2+y^2+z^2}$ with some possible rounding errors. The total relative rounding error is at most two ulps.

If any of the components of the input quaternion is NaN, then NaN is returned. Otherwise, if any of the components is infinite, then a positive infinite value is returned.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
assert_eq!(q.norm(), 14.0f32.sqrt());
Source§

impl<T> PureQuaternion<T>
where T: Float,

Source

pub fn fast_norm(self) -> T

Calculates |self| without branching.

This function returns the same result as norm, if |self|² is a normal floating point number (i. e. there is no overflow nor underflow), or if self is zero. In these cases the maximum relative error of the result is guaranteed to be less than two ulps. In all other cases, there’s no guarantee on the precision of the result:

  • If |self|² overflows, then $\infty$ is returned.
  • If |self|² underflows to zero, then zero will be returned.
  • If |self|² is a subnormal number (very small floating point value with reduced relative precision), then the result is the square root of that.

In other words, this function can be imprecise for very large and very small floating point numbers, but it is generally faster than norm, because it does not do any branching. So if you are interested in maximum speed of your code, feel free to use this function. If you need to be precise results for the whole range of the floating point type T, stay with norm.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
assert_eq!(q.fast_norm(), q.norm());
Source§

impl<T> PureQuaternion<T>
where T: Float + FloatConst,

Source

pub fn exp(self) -> UnitQuaternion<T>

Given a pure quaternion $q$, returns $e^q$, where $e$ is the base of the natural logarithm.

This method computes the exponential of a quaternion, handling various edge cases to ensure numerical stability and correctness:

  1. NaN Input: If any component of the input quaternion is NaN, the method returns a quaternion filled with NaN values.

  2. Large Norm: If the norm of the pure quaternion is too large, the method may return a NaN quaternion or a quaternion with the correct magnitude but inaccurate direction.

§Example
let q = PureQuaternion::new(1.0f32, 2.0, 3.0);
let exp_q = q.exp();

Trait Implementations§

Source§

impl<T> Add<&PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&PureQuaternion<T>> for PureQuaternion<T>
where Self: Add<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Add>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&PureQuaternion<T>> for Quaternion<T>
where Self: Add<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&PureQuaternion<T>> for UnitQuaternion<T>
where Self: Add<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add<Quaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Quaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&Quaternion<T>> for PureQuaternion<T>
where Self: Add<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Add<Quaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &Quaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&T> for &PureQuaternion<T>
where PureQuaternion<T>: Add<T> + Clone, T: Clone,

Source§

type Output = <PureQuaternion<T> as Add<T>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&T> for PureQuaternion<T>
where Self: Add<T>, T: Clone,

Source§

type Output = <PureQuaternion<T> as Add<T>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add<UnitQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&UnitQuaternion<T>> for PureQuaternion<T>
where Self: Add<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Add<UnitQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Add<PureQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<PureQuaternion<T>> for Quaternion<T>
where T: Add<T, Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<PureQuaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Add<PureQuaternion<T>, Output = Quaternion<T>>,

Source§

type Output = Quaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<PureQuaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PQ32) -> Self::Output

Performs the + operation. Read more
Source§

impl Add<PureQuaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PQ64) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add<Quaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Quaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<Quaternion<T>> for PureQuaternion<T>
where T: Add<T, Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: Quaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<T> for &PureQuaternion<T>
where PureQuaternion<T>: Add<T> + Clone,

Source§

type Output = <PureQuaternion<T> as Add<T>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<T> for PureQuaternion<T>

Source§

type Output = Quaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: T) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Add<UnitQuaternion<T>>>::Output

The resulting type after applying the + operator.
Source§

fn add(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<UnitQuaternion<T>> for PureQuaternion<T>
where T: Add<T, Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

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

Source§

type Output = PureQuaternion<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T, S> AddAssign<S> for PureQuaternion<T>
where Self: Add<S, Output = Self> + Clone,

Source§

fn add_assign(&mut self, other: S)

Performs the += operation. Read more
Source§

impl<T: Clone> Clone for PureQuaternion<T>

Source§

fn clone(&self) -> PureQuaternion<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> ConstZero for PureQuaternion<T>
where T: ConstZero,

Source§

const ZERO: Self = Self::ZERO

The additive identity element of Self, 0.
Source§

impl<T: Debug> Debug for PureQuaternion<T>

Source§

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

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

impl<T: Default> Default for PureQuaternion<T>

Source§

fn default() -> PureQuaternion<T>

Returns the “default value” for a type. Read more
Source§

impl<'de, T> Deserialize<'de> for PureQuaternion<T>
where T: Deserialize<'de>,

Source§

fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
where D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for PureQuaternion<T>
where Self: Div<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Div>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for Quaternion<T>
where Self: Div<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&PureQuaternion<T>> for UnitQuaternion<T>
where Self: Div<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div<Quaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Quaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&Quaternion<T>> for PureQuaternion<T>
where Self: Div<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Div<Quaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &Quaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&T> for &PureQuaternion<T>
where PureQuaternion<T>: Div<T> + Clone, T: Clone,

Source§

type Output = <PureQuaternion<T> as Div<T>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&T> for PureQuaternion<T>
where Self: Div<T>, T: Clone,

Source§

type Output = <PureQuaternion<T> as Div<T>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div<UnitQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&UnitQuaternion<T>> for PureQuaternion<T>
where Self: Div<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Div<UnitQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Div<PureQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<PureQuaternion<T>> for Quaternion<T>
where T: Num + Clone + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<PureQuaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Div<PureQuaternion<T>, Output = Quaternion<T>>,

Source§

type Output = Quaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<PureQuaternion<f32>> for f32

Source§

type Output = PureQuaternion<f32>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PQ32) -> Self::Output

Performs the / operation. Read more
Source§

impl Div<PureQuaternion<f64>> for f64

Source§

type Output = PureQuaternion<f64>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PQ64) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div<Quaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Quaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<Quaternion<T>> for PureQuaternion<T>
where T: Num + Clone + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: Quaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<T> for &PureQuaternion<T>
where PureQuaternion<T>: Div<T> + Clone,

Source§

type Output = <PureQuaternion<T> as Div<T>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<T> for PureQuaternion<T>
where T: Div<T, Output = T> + Clone,

Source§

type Output = PureQuaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: T) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Div<UnitQuaternion<T>>>::Output

The resulting type after applying the / operator.
Source§

fn div(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<UnitQuaternion<T>> for PureQuaternion<T>
where T: Num + Clone + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for PureQuaternion<T>
where T: Num + Clone + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T, S> DivAssign<S> for PureQuaternion<T>
where Self: Div<S, Output = Self> + Clone,

Source§

fn div_assign(&mut self, other: S)

Performs the /= operation. Read more
Source§

impl<T: Hash> Hash for PureQuaternion<T>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T> Inv for &PureQuaternion<T>
where T: Clone + Neg<Output = T> + Num,

Source§

type Output = PureQuaternion<T>

The result after applying the operator.
Source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Source§

impl<T> Inv for PureQuaternion<T>
where for<'a> &'a Self: Inv<Output = PureQuaternion<T>>,

Source§

type Output = PureQuaternion<T>

The result after applying the operator.
Source§

fn inv(self) -> Self::Output

Returns the multiplicative inverse of self. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for PureQuaternion<T>
where Self: Mul<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for Quaternion<T>
where Self: Mul<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&PureQuaternion<T>> for UnitQuaternion<T>
where Self: Mul<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul<Quaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Quaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&Quaternion<T>> for PureQuaternion<T>
where Self: Mul<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Mul<Quaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &Quaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&T> for &PureQuaternion<T>
where PureQuaternion<T>: Mul<T> + Clone, T: Clone,

Source§

type Output = <PureQuaternion<T> as Mul<T>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&T> for PureQuaternion<T>
where Self: Mul<T>, T: Clone,

Source§

type Output = <PureQuaternion<T> as Mul<T>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul<UnitQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&UnitQuaternion<T>> for PureQuaternion<T>
where Self: Mul<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Mul<UnitQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Mul<PureQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<PureQuaternion<T>> for Quaternion<T>
where T: Neg<Output = T> + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T> + Clone,

Source§

type Output = Quaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<PureQuaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Mul<PureQuaternion<T>, Output = Quaternion<T>>,

Source§

type Output = Quaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<PureQuaternion<f32>> for f32

Source§

type Output = PureQuaternion<f32>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PQ32) -> Self::Output

Performs the * operation. Read more
Source§

impl Mul<PureQuaternion<f64>> for f64

Source§

type Output = PureQuaternion<f64>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PQ64) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul<Quaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Quaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<Quaternion<T>> for PureQuaternion<T>
where T: Neg<Output = T> + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T> + Clone,

Source§

type Output = Quaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: Quaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for &PureQuaternion<T>
where PureQuaternion<T>: Mul<T> + Clone,

Source§

type Output = <PureQuaternion<T> as Mul<T>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<T> for PureQuaternion<T>
where T: Mul<T, Output = T> + Clone,

Source§

type Output = PureQuaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: T) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Mul<UnitQuaternion<T>>>::Output

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<UnitQuaternion<T>> for PureQuaternion<T>
where PureQuaternion<T>: Mul<Quaternion<T>, Output = Quaternion<T>>,

Source§

type Output = Quaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for PureQuaternion<T>
where T: Neg<Output = T> + Add<T, Output = T> + Sub<T, Output = T> + Mul<T, Output = T> + Clone,

Source§

type Output = Quaternion<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T, S> MulAssign<S> for PureQuaternion<T>
where Self: Mul<S, Output = Self> + Clone,

Source§

fn mul_assign(&mut self, other: S)

Performs the *= operation. Read more
Source§

impl<T: PartialEq> PartialEq for PureQuaternion<T>

Source§

fn eq(&self, other: &PureQuaternion<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> Serialize for PureQuaternion<T>
where T: Serialize,

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for PureQuaternion<T>
where Self: Sub<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for Quaternion<T>
where Self: Sub<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&PureQuaternion<T>> for UnitQuaternion<T>
where Self: Sub<PureQuaternion<T>>, PureQuaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub<Quaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Quaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&Quaternion<T>> for PureQuaternion<T>
where Self: Sub<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Sub<Quaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &Quaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&T> for &PureQuaternion<T>
where PureQuaternion<T>: Sub<T> + Clone, T: Clone,

Source§

type Output = <PureQuaternion<T> as Sub<T>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&T> for PureQuaternion<T>
where Self: Sub<T>, T: Clone,

Source§

type Output = <PureQuaternion<T> as Sub<T>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub<UnitQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&UnitQuaternion<T>> for PureQuaternion<T>
where Self: Sub<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <PureQuaternion<T> as Sub<UnitQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &UnitQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<PureQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<PureQuaternion<T>> for &Quaternion<T>

Source§

type Output = <Quaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<PureQuaternion<T>> for &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<T> as Sub<PureQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<PureQuaternion<T>> for Quaternion<T>
where T: Sub<T, Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<PureQuaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Sub<PureQuaternion<T>, Output = Quaternion<T>>,

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<PureQuaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PQ32) -> Self::Output

Performs the - operation. Read more
Source§

impl Sub<PureQuaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PQ64) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<Quaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub<Quaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Quaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<Quaternion<T>> for PureQuaternion<T>
where T: Sub<T, Output = T> + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: Quaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<T> for &PureQuaternion<T>
where PureQuaternion<T>: Sub<T> + Clone,

Source§

type Output = <PureQuaternion<T> as Sub<T>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<T> for PureQuaternion<T>
where T: Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: T) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<UnitQuaternion<T>> for &PureQuaternion<T>

Source§

type Output = <PureQuaternion<T> as Sub<UnitQuaternion<T>>>::Output

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<UnitQuaternion<T>> for PureQuaternion<T>
where T: Sub<T, Output = T> + Neg<Output = T>,

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: UnitQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

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

Source§

type Output = PureQuaternion<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: PureQuaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, S> SubAssign<S> for PureQuaternion<T>
where Self: Sub<S, Output = Self> + Clone,

Source§

fn sub_assign(&mut self, other: S)

Performs the -= operation. Read more
Source§

impl<T> Zero for PureQuaternion<T>
where T: Zero,

Source§

fn zero() -> Self

Returns the additive identity element of Self, 0. Read more
Source§

fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.
Source§

fn set_zero(&mut self)

Sets self to the additive identity element of Self, 0.
Source§

impl<T: Copy> Copy for PureQuaternion<T>

Source§

impl<T: Eq> Eq for PureQuaternion<T>

Source§

impl<T> StructuralPartialEq for PureQuaternion<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

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

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.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,