Struct nalgebra::geometry::Quaternion
source · Expand description
A quaternion. See the type alias UnitQuaternion = Unit<Quaternion>
for a quaternion
that may be used as a rotation.
Fields§
§coords: Vector4<N>
This quaternion as a 4D vector of coordinates in the [ x, y, z, w ]
storage order.
Implementations§
source§impl<N: Real> Quaternion<N>
impl<N: Real> Quaternion<N>
sourcepub fn into_owned(self) -> Quaternion<N>
👎Deprecated: This method is a no-op and will be removed in a future release.
pub fn into_owned(self) -> Quaternion<N>
Moves this unit quaternion into one that owns its data.
sourcepub fn clone_owned(&self) -> Quaternion<N>
👎Deprecated: This method is a no-op and will be removed in a future release.
pub fn clone_owned(&self) -> Quaternion<N>
Clones this unit quaternion into one that owns its data.
sourcepub fn normalize(&self) -> Quaternion<N>
pub fn normalize(&self) -> Quaternion<N>
Normalizes this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let q_normalized = q.normalize();
relative_eq!(q_normalized.norm(), 1.0);
sourcepub fn conjugate(&self) -> Quaternion<N>
pub fn conjugate(&self) -> Quaternion<N>
The conjugate of this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let conj = q.conjugate();
assert!(conj.i == -2.0 && conj.j == -3.0 && conj.k == -4.0 && conj.w == 1.0);
sourcepub fn try_inverse(&self) -> Option<Quaternion<N>>
pub fn try_inverse(&self) -> Option<Quaternion<N>>
Inverts this quaternion if it is not zero.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let inv_q = q.try_inverse();
assert!(inv_q.is_some());
assert_relative_eq!(inv_q.unwrap() * q, Quaternion::identity());
//Non-invertible case
let q = Quaternion::new(0.0, 0.0, 0.0, 0.0);
let inv_q = q.try_inverse();
assert!(inv_q.is_none());
sourcepub fn lerp(&self, other: &Quaternion<N>, t: N) -> Quaternion<N>
pub fn lerp(&self, other: &Quaternion<N>, t: N) -> Quaternion<N>
Linear interpolation between two quaternion.
Computes self * (1 - t) + other * t
.
Example
let q1 = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let q2 = Quaternion::new(10.0, 20.0, 30.0, 40.0);
assert_eq!(q1.lerp(&q2, 0.1), Quaternion::new(1.9, 3.8, 5.7, 7.6));
sourcepub fn vector(
&self
) -> MatrixSlice<'_, N, U3, U1, RStride<N, U4, U1>, CStride<N, U4, U1>>
pub fn vector(
&self
) -> MatrixSlice<'_, N, U3, U1, RStride<N, U4, U1>, CStride<N, U4, U1>>
The vector part (i, j, k)
of this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(q.vector()[0], 2.0);
assert_eq!(q.vector()[1], 3.0);
assert_eq!(q.vector()[2], 4.0);
sourcepub fn scalar(&self) -> N
pub fn scalar(&self) -> N
The scalar part w
of this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(q.scalar(), 1.0);
sourcepub fn as_vector(&self) -> &Vector4<N>
pub fn as_vector(&self) -> &Vector4<N>
Reinterprets this quaternion as a 4D vector.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
// Recall that the quaternion is stored internally as (i, j, k, w)
// while the ::new constructor takes the arguments as (w, i, j, k).
assert_eq!(*q.as_vector(), Vector4::new(2.0, 3.0, 4.0, 1.0));
sourcepub fn norm(&self) -> N
pub fn norm(&self) -> N
The norm of this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_relative_eq!(q.norm(), 5.47722557, epsilon = 1.0e-6);
sourcepub fn magnitude(&self) -> N
pub fn magnitude(&self) -> N
A synonym for the norm of this quaternion.
Aka the length.
This is the same as .norm()
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_relative_eq!(q.magnitude(), 5.47722557, epsilon = 1.0e-6);
sourcepub fn norm_squared(&self) -> N
pub fn norm_squared(&self) -> N
The squared norm of this quaternion.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(q.magnitude_squared(), 30.0);
sourcepub fn magnitude_squared(&self) -> N
pub fn magnitude_squared(&self) -> N
A synonym for the squared norm of this quaternion.
Aka the squared length.
This is the same as .norm_squared()
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_eq!(q.magnitude_squared(), 30.0);
sourcepub fn dot(&self, rhs: &Self) -> N
pub fn dot(&self, rhs: &Self) -> N
The dot product of two quaternions.
Example
let q1 = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let q2 = Quaternion::new(5.0, 6.0, 7.0, 8.0);
assert_eq!(q1.dot(&q2), 70.0);
sourcepub fn polar_decomposition(&self) -> (N, N, Option<Unit<Vector3<N>>>)
pub fn polar_decomposition(&self) -> (N, N, Option<Unit<Vector3<N>>>)
The polar decomposition of this quaternion.
Returns, from left to right: the quaternion norm, the half rotation angle, the rotation
axis. If the rotation angle is zero, the rotation axis is set to None
.
Example
let q = Quaternion::new(0.0, 5.0, 0.0, 0.0);
let (norm, half_ang, axis) = q.polar_decomposition();
assert_eq!(norm, 5.0);
assert_eq!(half_ang, f32::consts::FRAC_PI_2);
assert_eq!(axis, Some(Vector3::x_axis()));
sourcepub fn ln(&self) -> Quaternion<N>
pub fn ln(&self) -> Quaternion<N>
Compute the natural logarithm of a quaternion.
Example
let q = Quaternion::new(2.0, 5.0, 0.0, 0.0);
assert_relative_eq!(q.ln(), Quaternion::new(1.683647, 1.190289, 0.0, 0.0), epsilon = 1.0e-6)
sourcepub fn exp(&self) -> Quaternion<N>
pub fn exp(&self) -> Quaternion<N>
Compute the exponential of a quaternion.
Example
let q = Quaternion::new(1.683647, 1.190289, 0.0, 0.0);
assert_relative_eq!(q.exp(), Quaternion::new(2.0, 5.0, 0.0, 0.0), epsilon = 1.0e-5)
sourcepub fn exp_eps(&self, eps: N) -> Quaternion<N>
pub fn exp_eps(&self, eps: N) -> Quaternion<N>
Compute the exponential of a quaternion. Returns the identity if the vector part of this quaternion
has a norm smaller than eps
.
Example
let q = Quaternion::new(1.683647, 1.190289, 0.0, 0.0);
assert_relative_eq!(q.exp_eps(1.0e-6), Quaternion::new(2.0, 5.0, 0.0, 0.0), epsilon = 1.0e-5);
// Singular case.
let q = Quaternion::new(0.0000001, 0.0, 0.0, 0.0);
assert_eq!(q.exp_eps(1.0e-6), Quaternion::identity());
sourcepub fn powf(&self, n: N) -> Quaternion<N>
pub fn powf(&self, n: N) -> Quaternion<N>
Raise the quaternion to a given floating power.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert_relative_eq!(q.powf(1.5), Quaternion::new( -6.2576659, 4.1549037, 6.2323556, 8.3098075), epsilon = 1.0e-6);
sourcepub fn as_vector_mut(&mut self) -> &mut Vector4<N>
pub fn as_vector_mut(&mut self) -> &mut Vector4<N>
Transforms this quaternion into its 4D vector form (Vector part, Scalar part).
Example
let mut q = Quaternion::identity();
*q.as_vector_mut() = Vector4::new(1.0, 2.0, 3.0, 4.0);
assert!(q.i == 1.0 && q.j == 2.0 && q.k == 3.0 && q.w == 4.0);
sourcepub fn vector_mut(
&mut self
) -> MatrixSliceMut<'_, N, U3, U1, RStride<N, U4, U1>, CStride<N, U4, U1>>
pub fn vector_mut(
&mut self
) -> MatrixSliceMut<'_, N, U3, U1, RStride<N, U4, U1>, CStride<N, U4, U1>>
The mutable vector part (i, j, k)
of this quaternion.
Example
let mut q = Quaternion::identity();
{
let mut v = q.vector_mut();
v[0] = 2.0;
v[1] = 3.0;
v[2] = 4.0;
}
assert!(q.i == 2.0 && q.j == 3.0 && q.k == 4.0 && q.w == 1.0);
sourcepub fn conjugate_mut(&mut self)
pub fn conjugate_mut(&mut self)
Replaces this quaternion by its conjugate.
Example
let mut q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
q.conjugate_mut();
assert!(q.i == -2.0 && q.j == -3.0 && q.k == -4.0 && q.w == 1.0);
sourcepub fn try_inverse_mut(&mut self) -> bool
pub fn try_inverse_mut(&mut self) -> bool
Inverts this quaternion in-place if it is not zero.
Example
let mut q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert!(q.try_inverse_mut());
assert_relative_eq!(q * Quaternion::new(1.0, 2.0, 3.0, 4.0), Quaternion::identity());
//Non-invertible case
let mut q = Quaternion::new(0.0, 0.0, 0.0, 0.0);
assert!(!q.try_inverse_mut());
sourcepub fn normalize_mut(&mut self) -> N
pub fn normalize_mut(&mut self) -> N
Normalizes this quaternion.
Example
let mut q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
q.normalize_mut();
assert_relative_eq!(q.norm(), 1.0);
source§impl<N: Real> Quaternion<N>
impl<N: Real> Quaternion<N>
sourcepub fn from_vector(vector: Vector4<N>) -> Self
👎Deprecated: Use ::from
instead.
pub fn from_vector(vector: Vector4<N>) -> Self
::from
instead.Creates a quaternion from a 4D vector. The quaternion scalar part corresponds to the w
vector component.
sourcepub fn new(w: N, i: N, j: N, k: N) -> Self
pub fn new(w: N, i: N, j: N, k: N) -> Self
Creates a new quaternion from its individual components. Note that the arguments order does not follow the storage order.
The storage order is [ i, j, k, w ]
while the arguments for this functions are in the
order (w, i, j, k)
.
Example
let q = Quaternion::new(1.0, 2.0, 3.0, 4.0);
assert!(q.i == 2.0 && q.j == 3.0 && q.k == 4.0 && q.w == 1.0);
assert_eq!(*q.as_vector(), Vector4::new(2.0, 3.0, 4.0, 1.0));
sourcepub fn from_parts<SB>(scalar: N, vector: Vector<N, U3, SB>) -> Selfwhere
SB: Storage<N, U3>,
pub fn from_parts<SB>(scalar: N, vector: Vector<N, U3, SB>) -> Selfwhere
SB: Storage<N, U3>,
Creates a new quaternion from its scalar and vector parts. Note that the arguments order does not follow the storage order.
The storage order is [ vector, scalar ].
Example
let w = 1.0;
let ijk = Vector3::new(2.0, 3.0, 4.0);
let q = Quaternion::from_parts(w, ijk);
assert!(q.i == 2.0 && q.j == 3.0 && q.k == 4.0 && q.w == 1.0);
assert_eq!(*q.as_vector(), Vector4::new(2.0, 3.0, 4.0, 1.0));
Trait Implementations§
source§impl<N: Real + AbsDiffEq<Epsilon = N>> AbsDiffEq<Quaternion<N>> for Quaternion<N>
impl<N: Real + AbsDiffEq<Epsilon = N>> AbsDiffEq<Quaternion<N>> for Quaternion<N>
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§impl<N: Real> AbstractGroupAbelian<Additive> for Quaternion<N>
impl<N: Real> AbstractGroupAbelian<Additive> for Quaternion<N>
source§fn prop_is_commutative_approx(args: (Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_is_commutative_approx(args: (Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
true
if the operator is commutative for the given argument tuple. Approximate
equality is used for verifications. Read moresource§impl<N: Real> AbstractMagma<Additive> for Quaternion<N>
impl<N: Real> AbstractMagma<Additive> for Quaternion<N>
source§impl<N: Real> AbstractMagma<Multiplicative> for Quaternion<N>
impl<N: Real> AbstractMagma<Multiplicative> for Quaternion<N>
source§impl<N: Real> AbstractModule<Additive, Additive, Multiplicative> for Quaternion<N>
impl<N: Real> AbstractModule<Additive, Additive, Multiplicative> for Quaternion<N>
§type AbstractRing = N
type AbstractRing = N
source§fn multiply_by(&self, n: N) -> Self
fn multiply_by(&self, n: N) -> Self
source§impl<N: Real> AbstractMonoid<Additive> for Quaternion<N>
impl<N: Real> AbstractMonoid<Additive> for Quaternion<N>
source§fn prop_operating_identity_element_is_noop_approx(args: (Self,)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_operating_identity_element_is_noop_approx(args: (Self,)) -> boolwhere
Self: RelativeEq<Self>,
source§impl<N: Real> AbstractMonoid<Multiplicative> for Quaternion<N>
impl<N: Real> AbstractMonoid<Multiplicative> for Quaternion<N>
source§fn prop_operating_identity_element_is_noop_approx(args: (Self,)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_operating_identity_element_is_noop_approx(args: (Self,)) -> boolwhere
Self: RelativeEq<Self>,
source§impl<N: Real> AbstractQuasigroup<Additive> for Quaternion<N>
impl<N: Real> AbstractQuasigroup<Additive> for Quaternion<N>
source§fn prop_inv_is_latin_square_approx(args: (Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_inv_is_latin_square_approx(args: (Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
true
if latin squareness holds for the given arguments. Approximate
equality is used for verifications. Read moresource§impl<N: Real> AbstractSemigroup<Additive> for Quaternion<N>
impl<N: Real> AbstractSemigroup<Additive> for Quaternion<N>
source§fn prop_is_associative_approx(args: (Self, Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_is_associative_approx(args: (Self, Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
true
if associativity holds for the given arguments. Approximate equality is used
for verifications. Read moresource§impl<N: Real> AbstractSemigroup<Multiplicative> for Quaternion<N>
impl<N: Real> AbstractSemigroup<Multiplicative> for Quaternion<N>
source§fn prop_is_associative_approx(args: (Self, Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
fn prop_is_associative_approx(args: (Self, Self, Self)) -> boolwhere
Self: RelativeEq<Self>,
true
if associativity holds for the given arguments. Approximate equality is used
for verifications. Read moresource§impl<'a, 'b, N: Real> Add<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, 'b, N: Real> Add<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
+
operator.source§impl<'b, N: Real> Add<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> Add<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
+
operator.source§impl<'a, N: Real> Add<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, N: Real> Add<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
+
operator.source§impl<N: Real> Add<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> Add<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
+
operator.source§impl<'b, N: Real> AddAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> AddAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn add_assign(&mut self, rhs: &'b Quaternion<N>)
fn add_assign(&mut self, rhs: &'b Quaternion<N>)
+=
operation. Read moresource§impl<N: Real> AddAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> AddAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn add_assign(&mut self, rhs: Quaternion<N>)
fn add_assign(&mut self, rhs: Quaternion<N>)
+=
operation. Read moresource§impl<N: Real> Clone for Quaternion<N>
impl<N: Real> Clone for Quaternion<N>
source§impl<N: Real> Deref for Quaternion<N>
impl<N: Real> Deref for Quaternion<N>
source§impl<N: Real> DerefMut for Quaternion<N>
impl<N: Real> DerefMut for Quaternion<N>
source§impl<N: Real> Distribution<Quaternion<N>> for Standardwhere
Standard: Distribution<N>,
impl<N: Real> Distribution<Quaternion<N>> for Standardwhere
Standard: Distribution<N>,
source§impl<'a, N: Real> Div<N> for &'a Quaternion<N>
impl<'a, N: Real> Div<N> for &'a Quaternion<N>
source§impl<N: Real> Div<N> for Quaternion<N>
impl<N: Real> Div<N> for Quaternion<N>
source§impl<N: Real> DivAssign<N> for Quaternion<N>
impl<N: Real> DivAssign<N> for Quaternion<N>
source§fn div_assign(&mut self, n: N)
fn div_assign(&mut self, n: N)
/=
operation. Read moresource§impl<N: Real> FiniteDimVectorSpace for Quaternion<N>
impl<N: Real> FiniteDimVectorSpace for Quaternion<N>
source§fn canonical_basis_element(i: usize) -> Self
fn canonical_basis_element(i: usize) -> Self
source§unsafe fn component_unchecked(&self, i: usize) -> &N
unsafe fn component_unchecked(&self, i: usize) -> &N
&self[i]
but without bound-checking.source§unsafe fn component_unchecked_mut(&mut self, i: usize) -> &mut N
unsafe fn component_unchecked_mut(&mut self, i: usize) -> &mut N
&mut self[i]
but without bound-checking.source§impl<N: Real> From<Matrix<N, U4, U1, <DefaultAllocator as Allocator<N, U4, U1>>::Buffer>> for Quaternion<N>
impl<N: Real> From<Matrix<N, U4, U1, <DefaultAllocator as Allocator<N, U4, U1>>::Buffer>> for Quaternion<N>
source§impl<N: Real> Identity<Multiplicative> for Quaternion<N>
impl<N: Real> Identity<Multiplicative> for Quaternion<N>
source§impl<'a, 'b, N: Real> Mul<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, 'b, N: Real> Mul<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
*
operator.source§impl<'b, N: Real> Mul<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> Mul<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
*
operator.source§impl<'a, N: Real> Mul<N> for &'a Quaternion<N>
impl<'a, N: Real> Mul<N> for &'a Quaternion<N>
source§impl<N: Real> Mul<N> for Quaternion<N>
impl<N: Real> Mul<N> for Quaternion<N>
source§impl<'a, N: Real> Mul<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, N: Real> Mul<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
*
operator.source§impl<N: Real> Mul<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> Mul<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
*
operator.source§impl<'b, N: Real> MulAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> MulAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn mul_assign(&mut self, rhs: &'b Quaternion<N>)
fn mul_assign(&mut self, rhs: &'b Quaternion<N>)
*=
operation. Read moresource§impl<N: Real> MulAssign<N> for Quaternion<N>
impl<N: Real> MulAssign<N> for Quaternion<N>
source§fn mul_assign(&mut self, n: N)
fn mul_assign(&mut self, n: N)
*=
operation. Read moresource§impl<N: Real> MulAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> MulAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn mul_assign(&mut self, rhs: Quaternion<N>)
fn mul_assign(&mut self, rhs: Quaternion<N>)
*=
operation. Read moresource§impl<'a, N: Real> Neg for &'a Quaternion<N>
impl<'a, N: Real> Neg for &'a Quaternion<N>
source§impl<N: Real> Neg for Quaternion<N>
impl<N: Real> Neg for Quaternion<N>
source§impl<N: Real> NormedSpace for Quaternion<N>
impl<N: Real> NormedSpace for Quaternion<N>
source§fn norm_squared(&self) -> N
fn norm_squared(&self) -> N
source§fn normalize_mut(&mut self) -> N
fn normalize_mut(&mut self) -> N
source§fn try_normalize(&self, min_norm: N) -> Option<Self>
fn try_normalize(&self, min_norm: N) -> Option<Self>
eps
.source§fn try_normalize_mut(&mut self, min_norm: N) -> Option<N>
fn try_normalize_mut(&mut self, min_norm: N) -> Option<N>
eps
. Read moresource§impl<N: Real> One for Quaternion<N>
impl<N: Real> One for Quaternion<N>
source§impl<N: Real> PartialEq<Quaternion<N>> for Quaternion<N>
impl<N: Real> PartialEq<Quaternion<N>> for Quaternion<N>
source§impl<N: Real + RelativeEq<Epsilon = N>> RelativeEq<Quaternion<N>> for Quaternion<N>
impl<N: Real + RelativeEq<Epsilon = N>> RelativeEq<Quaternion<N>> for Quaternion<N>
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§impl<'a, 'b, N: Real> Sub<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, 'b, N: Real> Sub<&'b Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
-
operator.source§impl<'b, N: Real> Sub<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> Sub<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
-
operator.source§impl<'a, N: Real> Sub<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'a, N: Real> Sub<Quaternion<N>> for &'a Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
-
operator.source§impl<N: Real> Sub<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> Sub<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
§type Output = Quaternion<N>
type Output = Quaternion<N>
-
operator.source§impl<'b, N: Real> SubAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<'b, N: Real> SubAssign<&'b Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn sub_assign(&mut self, rhs: &'b Quaternion<N>)
fn sub_assign(&mut self, rhs: &'b Quaternion<N>)
-=
operation. Read moresource§impl<N: Real> SubAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
impl<N: Real> SubAssign<Quaternion<N>> for Quaternion<N>where
DefaultAllocator: Allocator<N, U4, U1>,
source§fn sub_assign(&mut self, rhs: Quaternion<N>)
fn sub_assign(&mut self, rhs: Quaternion<N>)
-=
operation. Read moresource§impl<N1, N2> SubsetOf<Quaternion<N2>> for Quaternion<N1>where
N1: Real,
N2: Real + SupersetOf<N1>,
impl<N1, N2> SubsetOf<Quaternion<N2>> for Quaternion<N1>where
N1: Real,
N2: Real + SupersetOf<N1>,
source§fn to_superset(&self) -> Quaternion<N2>
fn to_superset(&self) -> Quaternion<N2>
self
to the equivalent element of its superset.source§fn is_in_subset(q: &Quaternion<N2>) -> bool
fn is_in_subset(q: &Quaternion<N2>) -> bool
element
is actually part of the subset Self
(and can be converted to it).source§unsafe fn from_superset_unchecked(q: &Quaternion<N2>) -> Self
unsafe fn from_superset_unchecked(q: &Quaternion<N2>) -> Self
self.to_superset
but without any property checks. Always succeeds.source§impl<N: Real + UlpsEq<Epsilon = N>> UlpsEq<Quaternion<N>> for Quaternion<N>
impl<N: Real + UlpsEq<Epsilon = N>> UlpsEq<Quaternion<N>> for Quaternion<N>
source§impl<N: Real> VectorSpace for Quaternion<N>
impl<N: Real> VectorSpace for Quaternion<N>
source§impl<N: Real> Zero for Quaternion<N>
impl<N: Real> Zero for Quaternion<N>
impl<N: Real> AbstractGroup<Additive> for Quaternion<N>
impl<N: Real> AbstractLoop<Additive> for Quaternion<N>
impl<N: Real> Copy for Quaternion<N>
impl<N: Real + Eq> Eq for Quaternion<N>
Auto Trait Implementations§
impl<N> RefUnwindSafe for Quaternion<N>where
N: RefUnwindSafe,
impl<N> Send for Quaternion<N>
impl<N> Sync for Quaternion<N>
impl<N> Unpin for Quaternion<N>where
N: Unpin,
impl<N> UnwindSafe for Quaternion<N>where
N: UnwindSafe,
Blanket Implementations§
source§impl<T> Rand for Twhere
Standard: Distribution<T>,
impl<T> Rand for Twhere
Standard: Distribution<T>,
source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moresource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.