Struct num_quaternion::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 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.
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: TReal part of the quaternion.
x: TThe coefficient of $i$.
y: TThe coefficient of $j$.
z: TThe coefficient of $k$.
Implementations§
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>where
T: ConstZero,
impl<T> Quaternion<T>where
T: ConstZero,
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
sourcepub const ONE: Self = _
pub const ONE: Self = _
A constant Quaternion of value $1$.
See also Quaternion::one.
sourcepub const I: Self = _
pub const I: Self = _
A constant Quaternion of value $i$.
See also Quaternion::i.
sourcepub const J: Self = _
pub const J: Self = _
A constant Quaternion of value $j$.
See also Quaternion::j.
sourcepub const K: Self = _
pub const K: Self = _
A constant Quaternion of value $k$.
See also Quaternion::k.
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
sourcepub fn i() -> Self
pub fn i() -> Self
Returns the imaginary unit $i$.
See also Quaternion::I.
sourcepub fn j() -> Self
pub fn j() -> Self
Returns the imaginary unit $j$.
See also Quaternion::J.
sourcepub fn k() -> Self
pub fn k() -> Self
Returns the imaginary unit $k$.
See also Quaternion::K.
source§impl<T> Quaternion<T>where
T: Float,
impl<T> Quaternion<T>where
T: Float,
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
sourcepub fn norm_sqr(&self) -> T
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.
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>where
T: Float,
impl<T> Quaternion<T>where
T: Float,
sourcepub fn norm(self) -> T
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.
sourcepub fn fast_norm(self) -> T
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.
sourcepub fn normalize(self) -> Option<UnitQuaternion<T>>
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
NaNvalue, thenNonewill be returned.
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
source§impl<T> Quaternion<T>where
T: Float + FloatConst,
impl<T> Quaternion<T>where
T: Float + FloatConst,
sourcepub fn exp(self) -> Self
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:
-
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.
-
NaN Input: If any component of the input quaternion is
NaN, the method returns a quaternion filled withNaNvalues. -
Large Imaginary Norm: If the norm of the imaginary part is too large, the method may return a
NaNquaternion or a quaternion with the correct magnitude but inaccurate direction. -
Infinite Result: If $e^{\Re q}$ results in
+∞, the method computes the direction and returns an infinite quaternion in that direction, ensuring that∞ * 0values are mapped to zero instead ofNaN. -
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.
sourcepub fn ln(self) -> Self
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 + 0i$, the result is $-\infty+\pi i$. (The coefficients of $j$ and $k$ are zero with the signs copied.)
- If $q = +0$, the result is $-\infty$.
- If the input has a
NaNvalue, then the result isNaNin 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$.
sourcepub fn sqrt(self) -> Self
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 isNaNin all components. - Otherwise, for any input $c$, the expression
c.sqrt().conj()is exactly equivalent toc.conj().sqrt(), including the signs of zeros and infinities, if any. - For any input $c$,
c.sqrt().walways 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
NaNinput. - 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.
Trait Implementations§
source§impl<T> Add<&Quaternion<T>> for &Quaternion<T>
impl<T> Add<&Quaternion<T>> for &Quaternion<T>
source§impl<T> Add<&Quaternion<T>> for &UnitQuaternion<T>
impl<T> Add<&Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
+ operator.source§impl<T> Add<&Quaternion<T>> for Quaternion<T>
impl<T> Add<&Quaternion<T>> for Quaternion<T>
source§impl<T> Add<&Quaternion<T>> for UnitQuaternion<T>
impl<T> Add<&Quaternion<T>> for UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
+ operator.source§impl<T> Add<&T> for &Quaternion<T>
impl<T> Add<&T> for &Quaternion<T>
source§impl<T> Add<&T> for Quaternion<T>
impl<T> Add<&T> for Quaternion<T>
source§impl<T> Add<&UnitQuaternion<T>> for &Quaternion<T>
impl<T> Add<&UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
+ operator.source§impl<T> Add<&UnitQuaternion<T>> for Quaternion<T>
impl<T> Add<&UnitQuaternion<T>> for Quaternion<T>
§type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
+ operator.source§impl<T> Add<Quaternion<T>> for &Quaternion<T>
impl<T> Add<Quaternion<T>> for &Quaternion<T>
source§impl<T> Add<Quaternion<T>> for &UnitQuaternion<T>
impl<T> Add<Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Add<Quaternion<T>>>::Output
+ operator.source§impl<T> Add<Quaternion<T>> for UnitQuaternion<T>
impl<T> Add<Quaternion<T>> for UnitQuaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
+ operator.source§impl<T> Add<T> for &Quaternion<T>
impl<T> Add<T> for &Quaternion<T>
source§impl<T> Add<T> for Quaternion<T>where
T: Add<T, Output = T>,
impl<T> Add<T> for Quaternion<T>where
T: Add<T, Output = T>,
source§impl<T> Add<UnitQuaternion<T>> for &Quaternion<T>
impl<T> Add<UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Add<UnitQuaternion<T>>>::Output
+ operator.source§impl<T> Add<UnitQuaternion<T>> for Quaternion<T>where
T: Add<T, Output = T>,
impl<T> Add<UnitQuaternion<T>> for Quaternion<T>where
T: Add<T, Output = T>,
§type Output = Quaternion<T>
type Output = Quaternion<T>
+ operator.source§impl<T> Add for Quaternion<T>where
T: Add<T, Output = T>,
impl<T> Add for Quaternion<T>where
T: Add<T, Output = T>,
§type Output = Quaternion<T>
type Output = Quaternion<T>
+ operator.source§impl<T, S> AddAssign<S> for Quaternion<T>
impl<T, S> AddAssign<S> for Quaternion<T>
source§fn add_assign(&mut self, other: S)
fn add_assign(&mut self, other: S)
+= operation. Read moresource§impl<T> Borrow<Quaternion<T>> for UnitQuaternion<T>
impl<T> Borrow<Quaternion<T>> for UnitQuaternion<T>
source§fn borrow(&self) -> &Quaternion<T>
fn borrow(&self) -> &Quaternion<T>
source§impl<T: Clone> Clone for Quaternion<T>
impl<T: Clone> Clone for Quaternion<T>
source§fn clone(&self) -> Quaternion<T>
fn clone(&self) -> Quaternion<T>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl<T> ConstOne for Quaternion<T>
impl<T> ConstOne for Quaternion<T>
source§impl<T> ConstZero for Quaternion<T>where
T: ConstZero,
impl<T> ConstZero for Quaternion<T>where
T: ConstZero,
source§impl<T: Debug> Debug for Quaternion<T>
impl<T: Debug> Debug for Quaternion<T>
source§impl<T: Default> Default for Quaternion<T>
impl<T: Default> Default for Quaternion<T>
source§fn default() -> Quaternion<T>
fn default() -> Quaternion<T>
source§impl<'de, T> Deserialize<'de> for Quaternion<T>where
T: Deserialize<'de>,
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>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl<T> Div<&Quaternion<T>> for &Quaternion<T>
impl<T> Div<&Quaternion<T>> for &Quaternion<T>
source§impl<T> Div<&Quaternion<T>> for &UnitQuaternion<T>
impl<T> Div<&Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
/ operator.source§impl<T> Div<&Quaternion<T>> for Quaternion<T>
impl<T> Div<&Quaternion<T>> for Quaternion<T>
source§impl<T> Div<&Quaternion<T>> for UnitQuaternion<T>
impl<T> Div<&Quaternion<T>> for UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
/ operator.source§impl<T> Div<&T> for &Quaternion<T>
impl<T> Div<&T> for &Quaternion<T>
source§impl<T> Div<&T> for Quaternion<T>
impl<T> Div<&T> for Quaternion<T>
source§impl<T> Div<&UnitQuaternion<T>> for &Quaternion<T>
impl<T> Div<&UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
/ operator.source§impl<T> Div<&UnitQuaternion<T>> for Quaternion<T>
impl<T> Div<&UnitQuaternion<T>> for Quaternion<T>
§type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
/ operator.source§impl<T> Div<Quaternion<T>> for &Quaternion<T>
impl<T> Div<Quaternion<T>> for &Quaternion<T>
source§impl<T> Div<Quaternion<T>> for &UnitQuaternion<T>
impl<T> Div<Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Div<Quaternion<T>>>::Output
/ operator.source§impl<T> Div<Quaternion<T>> for UnitQuaternion<T>
impl<T> Div<Quaternion<T>> for UnitQuaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
/ operator.source§impl<T> Div<T> for &Quaternion<T>
impl<T> Div<T> for &Quaternion<T>
source§impl<T> Div<T> for Quaternion<T>
impl<T> Div<T> for Quaternion<T>
source§impl<T> Div<UnitQuaternion<T>> for &Quaternion<T>
impl<T> Div<UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Div<UnitQuaternion<T>>>::Output
/ operator.source§impl<T> Div<UnitQuaternion<T>> for Quaternion<T>
impl<T> Div<UnitQuaternion<T>> for Quaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
/ operator.source§impl<T> Div for Quaternion<T>
impl<T> Div for Quaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
/ operator.source§impl<T, S> DivAssign<S> for Quaternion<T>
impl<T, S> DivAssign<S> for Quaternion<T>
source§fn div_assign(&mut self, other: S)
fn div_assign(&mut self, other: S)
/= operation. Read moresource§impl<'a, T> From<&'a T> for Quaternion<T>
impl<'a, T> From<&'a T> for Quaternion<T>
source§impl<'a, T> From<&'a UnitQuaternion<T>> for &'a Quaternion<T>
impl<'a, T> From<&'a UnitQuaternion<T>> for &'a Quaternion<T>
source§fn from(q: &'a UnitQuaternion<T>) -> Self
fn from(q: &'a UnitQuaternion<T>) -> Self
source§impl<T> From<T> for Quaternion<T>where
T: Zero,
impl<T> From<T> for Quaternion<T>where
T: Zero,
source§impl<T> From<UnitQuaternion<T>> for Quaternion<T>
impl<T> From<UnitQuaternion<T>> for Quaternion<T>
source§fn from(q: UnitQuaternion<T>) -> Self
fn from(q: UnitQuaternion<T>) -> Self
source§impl<T: Hash> Hash for Quaternion<T>
impl<T: Hash> Hash for Quaternion<T>
source§impl<T> Inv for &Quaternion<T>
impl<T> Inv for &Quaternion<T>
source§impl<T> Inv for Quaternion<T>
impl<T> Inv for Quaternion<T>
source§impl<T> Mul<&Quaternion<T>> for &Quaternion<T>
impl<T> Mul<&Quaternion<T>> for &Quaternion<T>
source§impl<T> Mul<&Quaternion<T>> for &UnitQuaternion<T>
impl<T> Mul<&Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
* operator.source§impl<T> Mul<&Quaternion<T>> for Quaternion<T>
impl<T> Mul<&Quaternion<T>> for Quaternion<T>
source§impl<T> Mul<&Quaternion<T>> for UnitQuaternion<T>
impl<T> Mul<&Quaternion<T>> for UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
* operator.source§impl<T> Mul<&T> for &Quaternion<T>
impl<T> Mul<&T> for &Quaternion<T>
source§impl<T> Mul<&T> for Quaternion<T>
impl<T> Mul<&T> for Quaternion<T>
source§impl<T> Mul<&UnitQuaternion<T>> for &Quaternion<T>
impl<T> Mul<&UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
* operator.source§impl<T> Mul<&UnitQuaternion<T>> for Quaternion<T>
impl<T> Mul<&UnitQuaternion<T>> for Quaternion<T>
§type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
* operator.source§impl<T> Mul<Quaternion<T>> for &Quaternion<T>
impl<T> Mul<Quaternion<T>> for &Quaternion<T>
source§impl<T> Mul<Quaternion<T>> for &UnitQuaternion<T>
impl<T> Mul<Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Mul<Quaternion<T>>>::Output
* operator.source§impl<T> Mul<Quaternion<T>> for UnitQuaternion<T>
impl<T> Mul<Quaternion<T>> for UnitQuaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
* operator.source§impl<T> Mul<T> for &Quaternion<T>
impl<T> Mul<T> for &Quaternion<T>
source§impl<T> Mul<T> for Quaternion<T>
impl<T> Mul<T> for Quaternion<T>
source§impl<T> Mul<UnitQuaternion<T>> for &Quaternion<T>
impl<T> Mul<UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Mul<UnitQuaternion<T>>>::Output
* operator.source§impl<T> Mul<UnitQuaternion<T>> for Quaternion<T>
impl<T> Mul<UnitQuaternion<T>> for Quaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
* operator.source§impl<T> Mul for Quaternion<T>
impl<T> Mul for Quaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
* operator.source§impl<T, S> MulAssign<S> for Quaternion<T>
impl<T, S> MulAssign<S> for Quaternion<T>
source§fn mul_assign(&mut self, other: S)
fn mul_assign(&mut self, other: S)
*= operation. Read moresource§impl<T> Neg for Quaternion<T>where
T: Neg<Output = T>,
impl<T> Neg for Quaternion<T>where
T: Neg<Output = T>,
source§impl<T> One for Quaternion<T>
impl<T> One for Quaternion<T>
source§impl<T: PartialEq> PartialEq for Quaternion<T>
impl<T: PartialEq> PartialEq for Quaternion<T>
source§fn eq(&self, other: &Quaternion<T>) -> bool
fn eq(&self, other: &Quaternion<T>) -> bool
self and other values to be equal, and is used
by ==.source§impl<T> Serialize for Quaternion<T>where
T: Serialize,
impl<T> Serialize for Quaternion<T>where
T: Serialize,
source§impl<T> Sub<&Quaternion<T>> for &Quaternion<T>
impl<T> Sub<&Quaternion<T>> for &Quaternion<T>
source§impl<T> Sub<&Quaternion<T>> for &UnitQuaternion<T>
impl<T> Sub<&Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
- operator.source§impl<T> Sub<&Quaternion<T>> for Quaternion<T>
impl<T> Sub<&Quaternion<T>> for Quaternion<T>
source§impl<T> Sub<&Quaternion<T>> for UnitQuaternion<T>
impl<T> Sub<&Quaternion<T>> for UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
- operator.source§impl<T> Sub<&T> for &Quaternion<T>
impl<T> Sub<&T> for &Quaternion<T>
source§impl<T> Sub<&T> for Quaternion<T>
impl<T> Sub<&T> for Quaternion<T>
source§impl<T> Sub<&UnitQuaternion<T>> for &Quaternion<T>
impl<T> Sub<&UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
- operator.source§impl<T> Sub<&UnitQuaternion<T>> for Quaternion<T>
impl<T> Sub<&UnitQuaternion<T>> for Quaternion<T>
§type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
- operator.source§impl<T> Sub<Quaternion<T>> for &Quaternion<T>
impl<T> Sub<Quaternion<T>> for &Quaternion<T>
source§impl<T> Sub<Quaternion<T>> for &UnitQuaternion<T>
impl<T> Sub<Quaternion<T>> for &UnitQuaternion<T>
§type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
type Output = <UnitQuaternion<T> as Sub<Quaternion<T>>>::Output
- operator.source§impl<T> Sub<Quaternion<T>> for UnitQuaternion<T>
impl<T> Sub<Quaternion<T>> for UnitQuaternion<T>
§type Output = Quaternion<T>
type Output = Quaternion<T>
- operator.source§impl<T> Sub<T> for &Quaternion<T>
impl<T> Sub<T> for &Quaternion<T>
source§impl<T> Sub<T> for Quaternion<T>where
T: Sub<T, Output = T>,
impl<T> Sub<T> for Quaternion<T>where
T: Sub<T, Output = T>,
source§impl<T> Sub<UnitQuaternion<T>> for &Quaternion<T>
impl<T> Sub<UnitQuaternion<T>> for &Quaternion<T>
§type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
type Output = <Quaternion<T> as Sub<UnitQuaternion<T>>>::Output
- operator.source§impl<T> Sub<UnitQuaternion<T>> for Quaternion<T>where
T: Sub<T, Output = T>,
impl<T> Sub<UnitQuaternion<T>> for Quaternion<T>where
T: Sub<T, Output = T>,
§type Output = Quaternion<T>
type Output = Quaternion<T>
- operator.source§impl<T> Sub for Quaternion<T>where
T: Sub<T, Output = T>,
impl<T> Sub for Quaternion<T>where
T: Sub<T, Output = T>,
§type Output = Quaternion<T>
type Output = Quaternion<T>
- operator.source§impl<T, S> SubAssign<S> for Quaternion<T>
impl<T, S> SubAssign<S> for Quaternion<T>
source§fn sub_assign(&mut self, other: S)
fn sub_assign(&mut self, other: S)
-= operation. Read moresource§impl<T> Zero for Quaternion<T>where
T: Zero,
impl<T> Zero for Quaternion<T>where
T: Zero,
impl<T: Copy> Copy for Quaternion<T>
impl<T: Eq> Eq for Quaternion<T>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)