Quaternion

Struct Quaternion 

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

Quaternion type.

We follow the naming conventions from Wikipedia for quaternions. You can generate quaternions using the new function:

// 1 + 2i + 3j + 4k
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);

Alternatively, you can construct quaternions directly with the member data fields:

let q = Q32 { w: 1.0, x: 2.0, y: 3.0, z: 4.0 };

This is exactly equivalent to the first method. The latter example uses the shorthand Q32 for Quaternion<f32>. For your convenience, there are also the member constants ONE, I, J, and K for the mathematical values $1$, $i$, $j$, and $k$, respectively.

Quaternions support the usual arithmetic operations of addition, subtraction, multiplication, and division. You can compute the norm with norm or fast_norm and its square with norm_sqr. Quaternion conjugation is done by the member function conj. You can normalize a quaternion by calling normalize, which returns a UnitQuaternion.

Furthermore, the following functions are supported:

  • dot: Computes the dot product of two quaternions.
  • exp: Computes the exponential of a quaternion.
  • expf: Raises a real value to a quaternion power.
  • inv: Computes the multiplicative inverse.
  • ln: Computes the natural logarithm of a quaternion.
  • powf: Raises a quaternion to a real power.
  • powi: Raises a quaternion to a signed integer power.
  • powu: Raises a quaternion to an unsigned integer power.

To work with rotations, please use UnitQuaternions.

§Examples

Basic usage:

let q1 = Quaternion::new(1.0f32, 0.0, 0.0, 0.0);
let q2 = Quaternion::new(0.0, 1.0, 0.0, 0.0);
let q3 = q1 + q2;
assert_eq!(q3, Quaternion::new(1.0, 1.0, 0.0, 0.0));

§Fields

  • w: Real part of the quaternion.
  • x: The coefficient of $i$.
  • y: The coefficient of $j$.
  • z: The coefficient of $k$.

Fields§

§w: T

Real part of the quaternion.

§x: T

The coefficient of $i$.

§y: T

The coefficient of $j$.

§z: T

The coefficient of $k$.

Implementations§

Source§

impl<T> Quaternion<T>

Source

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

Create a new quaternion $a + bi + cj + dk$.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
Source§

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

Source

pub const ZERO: Self

A constant zero Quaternion.

This is the additive identity element of the quaternion space. See also Quaternion::zero.

§Example
let q = Quaternion::ZERO;
assert_eq!(q, Quaternion::new(0.0f32, 0.0, 0.0, 0.0));
Source§

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

Source

pub const ONE: Self

A constant Quaternion of value $1$.

See also Quaternion::one.

§Example
let q = Quaternion::ONE;
assert_eq!(q, Quaternion::new(1.0f32, 0.0, 0.0, 0.0));
Source

pub const I: Self

A constant Quaternion of value $i$.

See also Quaternion::i.

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

pub const J: Self

A constant Quaternion of value $j$.

See also Quaternion::j.

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

pub const K: Self

A constant Quaternion of value $k$.

See also Quaternion::k.

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

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

Source

pub fn one() -> Self

Returns the real unit $1$.

See also Quaternion::ONE.

§Example
let q = Quaternion::one();
assert_eq!(q, Quaternion::new(1.0f32, 0.0, 0.0, 0.0));
Source

pub fn i() -> Self

Returns the imaginary unit $i$.

See also Quaternion::I.

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

pub fn j() -> Self

Returns the imaginary unit $j$.

See also Quaternion::J.

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

pub fn k() -> Self

Returns the imaginary unit $k$.

See also Quaternion::K.

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

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

Source

pub fn nan() -> Self

Returns a quaternion filled with NaN values.

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

impl<T> Quaternion<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 $w^2 + 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 = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert_eq!(q.norm_sqr(), 30.0);
Source§

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

Source

pub fn conj(&self) -> Self

Returns the conjugate quaternion, i. e. the imaginary part is negated.

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

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

Source

pub fn inv(&self) -> Self

Returns the multiplicative inverse 1/self.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert_eq!(q.inv(), Quaternion::new(
    1.0 / 30.0, -1.0 / 15.0, -0.1, -2.0 / 15.0));
Source§

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

Source

pub fn norm(self) -> T

Calculates |self|.

The result is $\sqrt{w^2+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 = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert_eq!(q.norm(), 30.0f32.sqrt());
Source§

impl<T> Quaternion<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 = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert_eq!(q.fast_norm(), q.norm());
Source§

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

Source

pub fn normalize(self) -> Option<UnitQuaternion<T>>

Normalizes the quaternion to length $1$.

The sign of the real part will be the same as the sign of the input. If the input quaternion

  • is zero, or
  • has infinite length, or
  • has a NaN value,

then None will be returned.

§Example
let q = Quaternion::new(1.0f32, 2.0, 2.0, 4.0);
assert_eq!(q.normalize()?.into_quaternion(),
        Quaternion::new(0.2f32, 0.4, 0.4, 0.8));
Source§

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

Source

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

Computes the dot product of two quaternions interpreted as 4D real vectors.

§Example
let q1 = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let q2 = Quaternion::new(0.0f32, 0.0, 1.0, 1.0);
let d = q1.dot(q2);
assert_eq!(d, 7.0);
Source§

impl<T> Quaternion<T>
where T: Num + Clone,

Source

pub fn powu(&self, n: u32) -> Self

Raises self to an unsigned integer power n, i. e. $q^n$.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let q_sqr = q.powu(2);
assert_eq!(q_sqr, q * q);
Source§

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

Source

pub fn powi(&self, n: i32) -> Self

Raises self to a signed integer power n, i. e. $q^n$

For $n=0$ the result is exactly $1$.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let q_sqr = q.powi(2);
assert_eq!(q_sqr, q * q);
Source§

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

Source

pub fn exp(self) -> Self

Given a 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. Negative Real Part: If the real part is sufficiently negative, such that $e^{\Re q}$ is approximately zero, the method returns zero. This is done even if the imaginary part contains infinite or NaN values.

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

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

  4. Infinite Result: If $e^{\Re q}$ results in +∞, the method computes the direction and returns an infinite quaternion in that direction, ensuring that ∞ * 0 values are mapped to zero instead of NaN.

  5. Finite Norm: For finite norms, the method ensures a very small relative error in all components, depending on the accuracy of the underlying floating point function implementations.

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

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

Source

pub fn expf(self, base: T) -> Self

Raises a real value (base) to a quaternion (self) power.

Given a quaternion $q$ and a real value $t$, this function computes $t^q := e^{q \ln t}$. The function handles special cases as follows:

  • If $t = \pm 0$ and $\Re q > 0$, or $t = +\infty$ and $\Re q < 0$, a zero quaternion is returned.
  • If $t < 0$ or $t$ is NaN, a NaN quaternion (filled with NaN values) is returned.
  • If $t$ is $+0$, $-0$, or $+\infty$ and $\Re q = 0$, a NaN quaternion is returned.
  • If $t = +\infty$ and $q$ is a positive real number, $+\infty$ is returned. For other values of $q$ with $\Re q > 0$, a NaN quaternion is returned.
  • If $t = \pm 0$ and $q$ is a negative real number, $+\infty$ is returned. For other values of $q$ with $\Re q < 0$, a NaN quaternion is returned.

For finite positive $t$, the following conventions for boundary values of $q$ are applied:

  • If any component of $q$ is NaN or any imaginary component of $q$ is infinite, a NaN quaternion is returned.
  • Otherwise, if $\Re q = -\infty$ and $t > 1$, a zero quaternion is returned.
  • Otherwise, if $\Re q = +\infty$ and $0 < t < 1$, a zero quaternion is returned.
  • Otherwise, if $\Re q$ is infinite and $t = 1$, a NaN quaternion is returned.
  • Otherwise, if $\Re q = +\infty$ and $t > 1$, an infinite quaternion without NaN values is returned.
  • Otherwise, if $\Re q = -\infty$ and $0 < t < 1$, an infinite quaternion without NaN values is returned.

If the true result’s norm is neither greater than the largest representable floating point value nor less than the smallest representable floating point value, and the direction of the output quaternion cannot be accurately determined, a NaN quaternion may or may not be returned to indicate inaccuracy. This can occur when $|\Im(q) \ln t|$ is on the order of $1/\varepsilon$, where $\varepsilon$ is the machine precision of the floating point type used.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let exp_q = q.expf(2.0);
Source§

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

Source

pub fn powf(self, exponent: T) -> Self

Raises a quaternion (self) to a real value (exponent) power.

Given a quaternion $q$ and a real value $t$, this function computes $q^t := e^{t \ln q}$. The function handles special cases as follows:

  • If $q = 0$ and $t > 0$, a zero quaternion is returned.
  • If $|q| = \infty$ and $t < 0$, a zero quaternion is returned.
  • If $|q| = \infty$ and $t > 0$ is not too large to prevent numerical accuracy for the direction of the quaternion, then an infinite quaternion without NaN components is returned. For larger but finite values of $t$ this may still be hold, or alternatively a quaternion filled with NaN values is returned.
  • If $q = +\infty$ and $t = +\infty$, then positive infinity is returned.
  • If $|q| = \infty$, but $q \neq +\infty$ and $t = +\infty$, then NaN is returned.
  • If $q = 0$ and $t < 0$, then positive infinity is returned.
  • If $q$ contains a NaN component, or if $t$ is NaN, a NaN quaternion is returned.
  • If $|q| = \infty$ and $t = 0$, a NaN quaternion is returned.
  • If $q = 0$ and $t = 0$, a NaN quaternion is returned.

For non-zero finite $q$, the following conventions for boundary values of $t$ are applied:

  • If $t = +\infty$ and $q, |q| \ge 1$ is not real or $q = 1$ or $q \le -1$, a NaN quaternion is returned.
  • If $t = +\infty$ and $q > 1$, positive infinity is returned.
  • If $t = +\infty$ and $|q| < 1$, zero is returned.
  • If $t = -\infty$ and $|q| > 1$, zero is returned.
  • If $t = -\infty$ and $0 \le q < 1$, positive infinity is returned.
  • If $t = -\infty$ and $q, |q| \le 1$ is not real or $q = 1$ or $-1 \le q < 0$, a NaN quaternion is returned.

If the true result’s norm is neither greater than the largest representable floating point value nor less than the smallest representable floating point value, and the direction of the output quaternion cannot be accurately determined, a NaN quaternion may or may not be returned to indicate inaccuracy. This can occur when $|t \Im(\ln q)|$ is on the order of $1/\varepsilon$, where $\varepsilon$ is the machine precision of the floating point type used.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let exp_q = q.powf(2.0);
Source§

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

Source

pub fn is_finite(&self) -> bool

Returns whether all components of the quaternion are finite.

If a Quaternion has an infinite or NaN entry, the function returns false, otherwise true.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert!(q.is_finite());
Source

pub fn has_nan(&self) -> bool

Returns whether any component of the quaternion is NaN.

§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
assert!(!q.has_nan());
Source

pub fn is_all_nan(&self) -> bool

Returns whether all components of a quaternion are NaN.

§Example
let q = Q64::nan();
assert!(q.is_all_nan());
Source§

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

Source

pub fn ln(self) -> Self

Computes the natural logarithm of a quaternion.

The function implements the following guarantees for extreme input values:

  • The function is continuous onto the branch cut taking into account the sign of the coefficient of $i$.
  • For all quaternions $q$ it holds q.conj().ln() == q.ln().conj().
  • The signs of the coefficients of the imaginary parts of the outputs are equal to the signs of the respective coefficients of the inputs. This also holds for signs of zeros, but not for NaNs.
  • If $q = 0$, the result is $-\infty$. (The coefficients of $i$, $j$, and $k$ are zero with the original signs copied.)
  • If the input has a NaN value, then the result is NaN in all components.
  • Otherwise, if $q = w + xi + yj + zk$ where at least one of $w, x, y, z$ is infinite, then the real part of the result is $+\infty$ and the imaginary part is the imaginary part of the logarithm of $f(w) + f(x)i + f(y)j + f(z)k$ where
    • $f(+\infty) := 1$,
    • $f(-\infty) :=-1$, and
    • $f(s) := 0$ for finite values of $s$.
§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let ln_q = q.ln();
Source§

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

Source

pub fn sqrt(self) -> Self

Given the input quaternion $c$, this function returns the quaternion $q$ which satisfies $q^2 = c$ and has a real part with a positive sign.

For extreme values, the following guarantees are implemented:

  • If any coefficient in $c$ is NaN, then the result is NaN in all components.
  • Otherwise, for any input $c$, the expression c.sqrt().conj() is exactly equivalent to c.conj().sqrt(), including the signs of zeros and infinities, if any.
  • For any input $c$, c.sqrt().w always has a positive sign.
  • For any input $c$, the signs of the three output imaginary parts are the same as the input imaginary parts in their respective order, except in the case of a NaN input.
  • For negative real inputs $c$, the result is $\pm\sqrt{-c} i$, where the sign is determined by the sign of the input’s coefficient of $i$.
  • If there is at least one infinite coefficient in the imaginary part, then the result will have the same infinite imaginary coefficients and the real part is $+\infty$. All other coefficients of the result are $0$ with the sign of the respective input.
  • If the real part is $-\infty$ and the imaginary part is finite, then the result is $\pm\infty i$ with the sign of the coefficient of $i$ from the input.
§Example
let q = Quaternion::new(1.0f32, 2.0, 3.0, 4.0);
let sqrt_q = q.sqrt();

Trait Implementations§

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 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<&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 &Quaternion<T>
where Quaternion<T>: Add<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Add>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<&Quaternion<T>> for Quaternion<T>
where Self: Add<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Add>::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 UnitQuaternion<T>
where Self: Add<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<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 &Quaternion<T>
where Quaternion<T>: Add<T> + Clone, T: Clone,

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Add<T>, T: Clone,

Source§

type Output = <Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Add<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <Quaternion<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 &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 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<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 &Quaternion<T>
where Quaternion<T>: Add<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Add>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<Quaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Add<Output = Quaternion<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 Add<Quaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<i128>> for i128

Source§

type Output = Quaternion<i128>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<i16>> for i16

Source§

type Output = Quaternion<i16>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<i32>> for i32

Source§

type Output = Quaternion<i32>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<i64>> for i64

Source§

type Output = Quaternion<i64>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<i8>> for i8

Source§

type Output = Quaternion<i8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<isize>> for isize

Source§

type Output = Quaternion<isize>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<u128>> for u128

Source§

type Output = Quaternion<u128>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<u16>> for u16

Source§

type Output = Quaternion<u16>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<u32>> for u32

Source§

type Output = Quaternion<u32>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<u64>> for u64

Source§

type Output = Quaternion<u64>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<u8>> for u8

Source§

type Output = Quaternion<u8>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

impl Add<Quaternion<usize>> for usize

Source§

type Output = Quaternion<usize>

The resulting type after applying the + operator.
Source§

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

Performs the + operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 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: T) -> Self::Output

Performs the + operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 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: UnitQuaternion<T>) -> Self

Performs the + operation. Read more
Source§

impl<T> Add 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: Quaternion<T>) -> Self::Output

Performs the + operation. Read more
Source§

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

Source§

fn add_assign(&mut self, other: S)

Performs the += operation. Read more
Source§

impl<T> Borrow<Quaternion<T>> for UnitQuaternion<T>

Source§

fn borrow(&self) -> &Quaternion<T>

Immutably borrows from an owned value. Read more
Source§

impl<T: Clone> Clone for Quaternion<T>

Source§

fn clone(&self) -> Quaternion<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> ConstOne for Quaternion<T>
where T: ConstZero + ConstOne + Num + Clone,

Source§

const ONE: Self = Self::ONE

The multiplicative identity element of Self, 1.
Source§

impl<T> ConstZero for Quaternion<T>
where T: ConstZero,

Source§

const ZERO: Self = Self::ZERO

The additive identity element of Self, 0.
Source§

impl<T: Debug> Debug for Quaternion<T>

Source§

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

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

impl<T: Default> Default for Quaternion<T>

Source§

fn default() -> Quaternion<T>

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

impl<'de, T> Deserialize<'de> for Quaternion<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 &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 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<&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 &Quaternion<T>
where Quaternion<T>: Div<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Div>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<&Quaternion<T>> for Quaternion<T>
where Self: Div<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Div>::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 UnitQuaternion<T>
where Self: Div<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<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 &Quaternion<T>
where Quaternion<T>: Div<T> + Clone, T: Clone,

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Div<T>, T: Clone,

Source§

type Output = <Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Div<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <Quaternion<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 &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 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<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 &Quaternion<T>
where Quaternion<T>: Div<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Div>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<Quaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Div<Output = Quaternion<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 Div<Quaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

impl Div<Quaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the / operator.
Source§

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

Performs the / operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 Quaternion<T>
where T: Div<T, Output = T> + Clone,

Source§

type Output = Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Quaternion<T>: Mul<Output = Quaternion<T>>, T: Neg<Output = T> + Clone,

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 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: Quaternion<T>) -> Self

Performs the / operation. Read more
Source§

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

Source§

fn div_assign(&mut self, other: S)

Performs the /= operation. Read more
Source§

impl<T> From<&T> for Quaternion<T>
where T: Clone + Zero,

Source§

fn from(a: &T) -> Self

Converts to this type from the input type.
Source§

impl<'a, T> From<&'a UnitQuaternion<T>> for &'a Quaternion<T>

Source§

fn from(q: &'a UnitQuaternion<T>) -> Self

Converts to this type from the input type.
Source§

impl<T> From<T> for Quaternion<T>
where T: Zero,

Source§

fn from(a: T) -> Self

Converts to this type from the input type.
Source§

impl<T> From<UnitQuaternion<T>> for Quaternion<T>

Source§

fn from(q: UnitQuaternion<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Hash> Hash for Quaternion<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 &Quaternion<T>
where T: Clone + Neg<Output = T> + Num,

Source§

type Output = Quaternion<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 Quaternion<T>
where for<'a> &'a Self: Inv<Output = Quaternion<T>>,

Source§

type Output = Quaternion<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 &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 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<&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 &Quaternion<T>
where Quaternion<T>: Mul<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Mul>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<&Quaternion<T>> for Quaternion<T>
where Self: Mul<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Mul>::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 UnitQuaternion<T>
where Self: Mul<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<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 &Quaternion<T>
where Quaternion<T>: Mul<T> + Clone, T: Clone,

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Mul<T>, T: Clone,

Source§

type Output = <Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Mul<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <Quaternion<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 &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 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<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 &Quaternion<T>
where Quaternion<T>: Mul<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Mul>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<Quaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Mul<Output = Quaternion<T>>,

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 Mul<Quaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<i128>> for i128

Source§

type Output = Quaternion<i128>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<i16>> for i16

Source§

type Output = Quaternion<i16>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<i32>> for i32

Source§

type Output = Quaternion<i32>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<i64>> for i64

Source§

type Output = Quaternion<i64>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<i8>> for i8

Source§

type Output = Quaternion<i8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<isize>> for isize

Source§

type Output = Quaternion<isize>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<u128>> for u128

Source§

type Output = Quaternion<u128>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<u16>> for u16

Source§

type Output = Quaternion<u16>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<u32>> for u32

Source§

type Output = Quaternion<u32>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<u64>> for u64

Source§

type Output = Quaternion<u64>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<u8>> for u8

Source§

type Output = Quaternion<u8>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

impl Mul<Quaternion<usize>> for usize

Source§

type Output = Quaternion<usize>

The resulting type after applying the * operator.
Source§

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

Performs the * operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 Quaternion<T>
where T: Mul<T, Output = T> + Clone,

Source§

type Output = Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Quaternion<T>: Mul<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 Quaternion<T>
where 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, S> MulAssign<S> for Quaternion<T>
where Self: Mul<S, Output = Self> + Clone,

Source§

fn mul_assign(&mut self, other: S)

Performs the *= operation. Read more
Source§

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

Source§

type Output = Quaternion<T>

The resulting type after applying the - operator.
Source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
Source§

impl<T> One for Quaternion<T>
where T: Num + Clone,

Source§

fn one() -> Self

Returns the multiplicative identity element of Self, 1. Read more
Source§

fn is_one(&self) -> bool

Returns true if self is equal to the multiplicative identity. Read more
Source§

fn set_one(&mut self)

Sets self to the multiplicative identity element of Self, 1.
Source§

impl<T: PartialEq> PartialEq for Quaternion<T>

Source§

fn eq(&self, other: &Quaternion<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 Quaternion<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 &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 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<&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 &Quaternion<T>
where Quaternion<T>: Sub<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Sub>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<&Quaternion<T>> for Quaternion<T>
where Self: Sub<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <Quaternion<T> as Sub>::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 UnitQuaternion<T>
where Self: Sub<Quaternion<T>>, Quaternion<T>: Clone,

Source§

type Output = <UnitQuaternion<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 &Quaternion<T>
where Quaternion<T>: Sub<T> + Clone, T: Clone,

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Sub<T>, T: Clone,

Source§

type Output = <Quaternion<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 &Quaternion<T>

Source§

type Output = <Quaternion<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 Quaternion<T>
where Self: Sub<UnitQuaternion<T>>, UnitQuaternion<T>: Clone,

Source§

type Output = <Quaternion<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 &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 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<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 &Quaternion<T>
where Quaternion<T>: Sub<Quaternion<T>> + Clone,

Source§

type Output = <Quaternion<T> as Sub>::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 &UnitQuaternion<T>

Source§

type Output = <UnitQuaternion<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<Quaternion<T>> for UnitQuaternion<T>
where Quaternion<T>: Sub<Output = Quaternion<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 Sub<Quaternion<f32>> for f32

Source§

type Output = Quaternion<f32>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<f64>> for f64

Source§

type Output = Quaternion<f64>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<i128>> for i128

Source§

type Output = Quaternion<i128>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<i16>> for i16

Source§

type Output = Quaternion<i16>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<i32>> for i32

Source§

type Output = Quaternion<i32>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<i64>> for i64

Source§

type Output = Quaternion<i64>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<i8>> for i8

Source§

type Output = Quaternion<i8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<isize>> for isize

Source§

type Output = Quaternion<isize>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<u128>> for u128

Source§

type Output = Quaternion<u128>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<u16>> for u16

Source§

type Output = Quaternion<u16>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<u32>> for u32

Source§

type Output = Quaternion<u32>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<u64>> for u64

Source§

type Output = Quaternion<u64>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<u8>> for u8

Source§

type Output = Quaternion<u8>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

impl Sub<Quaternion<usize>> for usize

Source§

type Output = Quaternion<usize>

The resulting type after applying the - operator.
Source§

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

Performs the - operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 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: T) -> Self::Output

Performs the - operation. Read more
Source§

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

Source§

type Output = <Quaternion<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 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: UnitQuaternion<T>) -> Self

Performs the - operation. Read more
Source§

impl<T> Sub 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: Quaternion<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T, S> SubAssign<S> for Quaternion<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 Quaternion<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 Quaternion<T>

Source§

impl<T: Eq> Eq for Quaternion<T>

Source§

impl<T> StructuralPartialEq for Quaternion<T>

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<T> UnwindSafe for Quaternion<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>,