#[repr(C)]pub struct Quaternion<S> {
pub v: Vector3<S>,
pub s: S,
}Expand description
A quaternion in scalar/vector form.
This type is marked as #[repr(C)].
Fields
v: Vector3<S>The vector part of the quaternion.
s: SThe scalar part of the quaternion.
Implementations
sourceimpl<S> Quaternion<S>
impl<S> Quaternion<S>
sourcepub const fn new(w: S, xi: S, yj: S, zk: S) -> Quaternion<S>
pub const fn new(w: S, xi: S, yj: S, zk: S) -> Quaternion<S>
Construct a new quaternion from one scalar component and three imaginary components.
sourcepub const fn from_sv(s: S, v: Vector3<S>) -> Quaternion<S>
pub const fn from_sv(s: S, v: Vector3<S>) -> Quaternion<S>
Construct a new quaternion from a scalar and a vector.
sourceimpl<S> Quaternion<S> where
S: BaseFloat,
impl<S> Quaternion<S> where
S: BaseFloat,
sourcepub fn from_arc(
src: Vector3<S>,
dst: Vector3<S>,
fallback: Option<Vector3<S>>
) -> Quaternion<S>
pub fn from_arc(
src: Vector3<S>,
dst: Vector3<S>,
fallback: Option<Vector3<S>>
) -> Quaternion<S>
Construct a new quaternion as a closest arc between two vectors
Return the closest rotation that turns src vector into dst.
- [Related StackOverflow question] (http://stackoverflow.com/questions/1171849/finding-quaternion-representing-the-rotation-from-one-vector-to-another)
- [Ogre implementation for normalized vectors] (https://bitbucket.org/sinbad/ogre/src/9db75e3ba05c/OgreMain/include/OgreVector3.h?fileviewer=file-view-default#cl-651)
sourcepub fn conjugate(self) -> Quaternion<S>
pub fn conjugate(self) -> Quaternion<S>
The conjugate of the quaternion.
sourcepub fn nlerp(self, other: Quaternion<S>, amount: S) -> Quaternion<S>
pub fn nlerp(self, other: Quaternion<S>, amount: S) -> Quaternion<S>
Do a normalized linear interpolation with other, by amount.
This takes the shortest path, so if the quaternions have a negative
dot product, the interpolation will be between self and -other.
sourcepub fn slerp(self, other: Quaternion<S>, amount: S) -> Quaternion<S>
pub fn slerp(self, other: Quaternion<S>, amount: S) -> Quaternion<S>
Spherical Linear Interpolation
Return the spherical linear interpolation between the quaternion and
other. Both quaternions should be normalized first.
This takes the shortest path, so if the quaternions have a negative
dot product, the interpolation will be between self and -other.
Performance notes
The acos operation used in slerp is an expensive operation, so
unless your quaternions are far away from each other it’s generally
more advisable to use nlerp when you know your rotations are going
to be small.
- [Understanding Slerp, Then Not Using It] (http://number-none.com/product/Understanding%20Slerp,%20Then%20Not%20Using%20It/)
- [Arcsynthesis OpenGL tutorial] (http://www.arcsynthesis.org/gltut/Positioning/Tut08%20Interpolation.html)
pub fn is_finite(&self) -> bool
sourceimpl<S> Quaternion<S> where
S: NumCast + Copy,
impl<S> Quaternion<S> where
S: NumCast + Copy,
sourcepub fn cast<T>(&self) -> Option<Quaternion<T>> where
T: BaseFloat,
pub fn cast<T>(&self) -> Option<Quaternion<T>> where
T: BaseFloat,
Component-wise casting to another type.
Trait Implementations
sourceimpl<S> AbsDiffEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> AbsDiffEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Epsilon = <S as AbsDiffEq<S>>::Epsilon
type Epsilon = <S as AbsDiffEq<S>>::Epsilon
Used for specifying relative comparisons.
sourcefn default_epsilon() -> <S as AbsDiffEq<S>>::Epsilon
fn default_epsilon() -> <S as AbsDiffEq<S>>::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon
) -> bool
fn abs_diff_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon
) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
The inverse of [AbsDiffEq::abs_diff_eq].
sourceimpl<'a, 'b, S> Add<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
impl<'a, 'b, S> Add<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the + operator.
sourcefn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the + operation. Read more
sourceimpl<'a, S> Add<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<'a, S> Add<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the + operator.
sourcefn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the + operation. Read more
sourceimpl<S> Add<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Add<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the + operator.
sourcefn add(self, other: Quaternion<S>) -> Quaternion<S>
fn add(self, other: Quaternion<S>) -> Quaternion<S>
Performs the + operation. Read more
sourceimpl<'a, S> Add<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Add<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the + operator.
sourcefn add(self, other: Quaternion<S>) -> Quaternion<S>
fn add(self, other: Quaternion<S>) -> Quaternion<S>
Performs the + operation. Read more
sourceimpl<S> AddAssign<Quaternion<S>> for Quaternion<S> where
S: BaseFloat + AddAssign<S>,
impl<S> AddAssign<Quaternion<S>> for Quaternion<S> where
S: BaseFloat + AddAssign<S>,
sourcefn add_assign(&mut self, other: Quaternion<S>)
fn add_assign(&mut self, other: Quaternion<S>)
Performs the += operation. Read more
sourceimpl<S> Clone for Quaternion<S> where
S: Clone,
impl<S> Clone for Quaternion<S> where
S: Clone,
sourcefn clone(&self) -> Quaternion<S>
fn clone(&self) -> Quaternion<S>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source. Read more
sourceimpl<S> Debug for Quaternion<S> where
S: Debug,
impl<S> Debug for Quaternion<S> where
S: Debug,
sourceimpl<'a, S> Div<S> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Div<S> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the / operator.
sourcefn div(self, other: S) -> Quaternion<S>
fn div(self, other: S) -> Quaternion<S>
Performs the / operation. Read more
sourceimpl<S> Div<S> for Quaternion<S> where
S: BaseFloat,
impl<S> Div<S> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the / operator.
sourcefn div(self, other: S) -> Quaternion<S>
fn div(self, other: S) -> Quaternion<S>
Performs the / operation. Read more
sourceimpl<S> DivAssign<S> for Quaternion<S> where
S: BaseFloat + DivAssign<S>,
impl<S> DivAssign<S> for Quaternion<S> where
S: BaseFloat + DivAssign<S>,
sourcefn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
Performs the /= operation. Read more
sourceimpl<'a, S> From<&'a [S; 4]> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> From<&'a [S; 4]> for &'a Quaternion<S> where
S: BaseFloat,
sourcefn from(v: &'a [S; 4]) -> &'a Quaternion<S>
fn from(v: &'a [S; 4]) -> &'a Quaternion<S>
Converts to this type from the input type.
sourceimpl<'a, S> From<&'a (S, S, S, S)> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> From<&'a (S, S, S, S)> for &'a Quaternion<S> where
S: BaseFloat,
sourcefn from(v: &'a (S, S, S, S)) -> &'a Quaternion<S>
fn from(v: &'a (S, S, S, S)) -> &'a Quaternion<S>
Converts to this type from the input type.
sourceimpl<'a, S> From<&'a mut [S; 4]> for &'a mut Quaternion<S> where
S: BaseFloat,
impl<'a, S> From<&'a mut [S; 4]> for &'a mut Quaternion<S> where
S: BaseFloat,
sourcefn from(v: &'a mut [S; 4]) -> &'a mut Quaternion<S>
fn from(v: &'a mut [S; 4]) -> &'a mut Quaternion<S>
Converts to this type from the input type.
sourceimpl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Quaternion<S> where
S: BaseFloat,
impl<'a, S> From<&'a mut (S, S, S, S)> for &'a mut Quaternion<S> where
S: BaseFloat,
sourcefn from(v: &'a mut (S, S, S, S)) -> &'a mut Quaternion<S>
fn from(v: &'a mut (S, S, S, S)) -> &'a mut Quaternion<S>
Converts to this type from the input type.
sourceimpl<S> From<[S; 4]> for Quaternion<S> where
S: BaseFloat,
impl<S> From<[S; 4]> for Quaternion<S> where
S: BaseFloat,
sourcefn from(v: [S; 4]) -> Quaternion<S>
fn from(v: [S; 4]) -> Quaternion<S>
Converts to this type from the input type.
sourceimpl<S> From<(S, S, S, S)> for Quaternion<S> where
S: BaseFloat,
impl<S> From<(S, S, S, S)> for Quaternion<S> where
S: BaseFloat,
sourcefn from(v: (S, S, S, S)) -> Quaternion<S>
fn from(v: (S, S, S, S)) -> Quaternion<S>
Converts to this type from the input type.
sourceimpl<S> From<Basis3<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> From<Basis3<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn from(b: Basis3<S>) -> Quaternion<S>
fn from(b: Basis3<S>) -> Quaternion<S>
Converts to this type from the input type.
sourceimpl<A> From<Euler<A>> for Quaternion<<A as Angle>::Unitless> where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
impl<A> From<Euler<A>> for Quaternion<<A as Angle>::Unitless> where
A: Angle + Into<Rad<<A as Angle>::Unitless>>,
sourceimpl<S> From<Matrix3<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> From<Matrix3<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn from(mat: Matrix3<S>) -> Quaternion<S>
fn from(mat: Matrix3<S>) -> Quaternion<S>
Convert the matrix to a quaternion
sourceimpl<S> From<Quaternion<S>> for Matrix4<S> where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Matrix4<S> where
S: BaseFloat,
sourcefn from(quat: Quaternion<S>) -> Matrix4<S>
fn from(quat: Quaternion<S>) -> Matrix4<S>
Convert the quaternion to a 4 x 4 rotation matrix.
sourceimpl<S> From<Quaternion<S>> for Matrix3<S> where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Matrix3<S> where
S: BaseFloat,
sourcefn from(quat: Quaternion<S>) -> Matrix3<S>
fn from(quat: Quaternion<S>) -> Matrix3<S>
Convert the quaternion to a 3 x 3 rotation matrix.
sourceimpl<S> Index<RangeFull> for Quaternion<S> where
S: BaseFloat,
impl<S> Index<RangeFull> for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> Index<usize> for Quaternion<S> where
S: BaseFloat,
impl<S> Index<usize> for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> IndexMut<RangeFull> for Quaternion<S> where
S: BaseFloat,
impl<S> IndexMut<RangeFull> for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> IndexMut<usize> for Quaternion<S> where
S: BaseFloat,
impl<S> IndexMut<usize> for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> InnerSpace for Quaternion<S> where
S: BaseFloat,
impl<S> InnerSpace for Quaternion<S> where
S: BaseFloat,
sourcefn dot(self, other: Quaternion<S>) -> S
fn dot(self, other: Quaternion<S>) -> S
Vector dot (or inner) product.
sourcefn is_perpendicular(self, other: Self) -> bool where
Self::Scalar: UlpsEq<Self::Scalar>,
fn is_perpendicular(self, other: Self) -> bool where
Self::Scalar: UlpsEq<Self::Scalar>,
Returns true if the vector is perpendicular (at right angles) to the
other vector. Read more
sourcefn magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
Returns the squared magnitude. Read more
sourcefn angle(self, other: Self) -> Rad<Self::Scalar> where
Self::Scalar: BaseFloat,
fn angle(self, other: Self) -> Rad<Self::Scalar> where
Self::Scalar: BaseFloat,
Returns the angle between two vectors in radians.
sourcefn project_on(self, other: Self) -> Self
fn project_on(self, other: Self) -> Self
Returns the vector projection of the current inner space projected onto the supplied argument. Read more
sourcefn magnitude(self) -> Self::Scalar where
Self::Scalar: Float,
fn magnitude(self) -> Self::Scalar where
Self::Scalar: Float,
The distance from the tail to the tip of the vector.
sourcefn normalize(self) -> Self where
Self::Scalar: Float,
fn normalize(self) -> Self where
Self::Scalar: Float,
Returns a vector with the same direction, but with a magnitude of 1.
sourcefn normalize_to(self, magnitude: Self::Scalar) -> Self where
Self::Scalar: Float,
fn normalize_to(self, magnitude: Self::Scalar) -> Self where
Self::Scalar: Float,
Returns a vector with the same direction and a given magnitude.
sourceimpl<S> MetricSpace for Quaternion<S> where
S: BaseFloat,
impl<S> MetricSpace for Quaternion<S> where
S: BaseFloat,
sourceimpl<'a, S> Mul<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<'a, S> Mul<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<'a, 'b, S> Mul<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
impl<'a, 'b, S> Mul<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<'a, S> Mul<&'a Vector3<S>> for Quaternion<S> where
S: BaseFloat,
impl<'a, S> Mul<&'a Vector3<S>> for Quaternion<S> where
S: BaseFloat,
sourceimpl<'a, 'b, S> Mul<&'a Vector3<S>> for &'b Quaternion<S> where
S: BaseFloat,
impl<'a, 'b, S> Mul<&'a Vector3<S>> for &'b Quaternion<S> where
S: BaseFloat,
sourceimpl<S> Mul<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Mul<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: Quaternion<S>) -> Quaternion<S>
fn mul(self, other: Quaternion<S>) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<'a, S> Mul<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Mul<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: Quaternion<S>) -> Quaternion<S>
fn mul(self, other: Quaternion<S>) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<'a, S> Mul<S> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Mul<S> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: S) -> Quaternion<S>
fn mul(self, other: S) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<S> Mul<S> for Quaternion<S> where
S: BaseFloat,
impl<S> Mul<S> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the * operator.
sourcefn mul(self, other: S) -> Quaternion<S>
fn mul(self, other: S) -> Quaternion<S>
Performs the * operation. Read more
sourceimpl<'a, S> Mul<Vector3<S>> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Mul<Vector3<S>> for &'a Quaternion<S> where
S: BaseFloat,
sourceimpl<S> Mul<Vector3<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Mul<Vector3<S>> for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> MulAssign<S> for Quaternion<S> where
S: BaseFloat + MulAssign<S>,
impl<S> MulAssign<S> for Quaternion<S> where
S: BaseFloat + MulAssign<S>,
sourcefn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
Performs the *= operation. Read more
sourceimpl<S> Neg for Quaternion<S> where
S: BaseFloat,
impl<S> Neg for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn neg(self) -> Quaternion<S>
fn neg(self) -> Quaternion<S>
Performs the unary - operation. Read more
sourceimpl<'a, S> Neg for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Neg for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn neg(self) -> Quaternion<S>
fn neg(self) -> Quaternion<S>
Performs the unary - operation. Read more
sourceimpl<S> One for Quaternion<S> where
S: BaseFloat,
impl<S> One for Quaternion<S> where
S: BaseFloat,
sourcefn one() -> Quaternion<S>
fn one() -> Quaternion<S>
Returns the multiplicative identity element of Self, 1. Read more
sourceimpl<S> PartialEq<Quaternion<S>> for Quaternion<S> where
S: PartialEq<S>,
impl<S> PartialEq<Quaternion<S>> for Quaternion<S> where
S: PartialEq<S>,
sourcefn eq(&self, other: &Quaternion<S>) -> bool
fn eq(&self, other: &Quaternion<S>) -> bool
This method tests for self and other values to be equal, and is used
by ==. Read more
sourcefn ne(&self, other: &Quaternion<S>) -> bool
fn ne(&self, other: &Quaternion<S>) -> bool
This method tests for !=.
sourceimpl<'a, S> Product<&'a Quaternion<S>> for Quaternion<S> where
S: 'a + BaseFloat,
impl<'a, S> Product<&'a Quaternion<S>> for Quaternion<S> where
S: 'a + BaseFloat,
sourcefn product<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = &'a Quaternion<S>>,
fn product<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = &'a Quaternion<S>>,
Method which takes an iterator and generates Self from the elements by
multiplying the items. Read more
sourceimpl<S> Product<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Product<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn product<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = Quaternion<S>>,
fn product<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = Quaternion<S>>,
Method which takes an iterator and generates Self from the elements by
multiplying the items. Read more
sourceimpl<S> RelativeEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> RelativeEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn default_max_relative() -> <S as AbsDiffEq<S>>::Epsilon
fn default_max_relative() -> <S as AbsDiffEq<S>>::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon,
max_relative: <S as AbsDiffEq<S>>::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon,
max_relative: <S as AbsDiffEq<S>>::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of [RelativeEq::relative_eq].
sourceimpl<'a, S> Rem<S> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Rem<S> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the % operator.
sourcefn rem(self, other: S) -> Quaternion<S>
fn rem(self, other: S) -> Quaternion<S>
Performs the % operation. Read more
sourceimpl<S> Rem<S> for Quaternion<S> where
S: BaseFloat,
impl<S> Rem<S> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the % operator.
sourcefn rem(self, other: S) -> Quaternion<S>
fn rem(self, other: S) -> Quaternion<S>
Performs the % operation. Read more
sourceimpl<S> RemAssign<S> for Quaternion<S> where
S: BaseFloat + RemAssign<S>,
impl<S> RemAssign<S> for Quaternion<S> where
S: BaseFloat + RemAssign<S>,
sourcefn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
Performs the %= operation. Read more
sourceimpl<S> Rotation for Quaternion<S> where
S: BaseFloat,
impl<S> Rotation for Quaternion<S> where
S: BaseFloat,
sourcefn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>
fn rotate_vector(&self, vec: Vector3<S>) -> Vector3<S>
Evaluate the conjugation of vec by self.
Note that self should be a unit quaternion (i.e. normalized) to represent a 3D rotation.
type Space = Point3<S>
sourcefn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>
Create a rotation to a given direction with an ‘up’ vector.
sourcefn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>
fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>
Create a shortest rotation to transform vector ‘a’ into ‘b’. Both given vectors are assumed to have unit length. Read more
sourcefn invert(&self) -> Quaternion<S>
fn invert(&self) -> Quaternion<S>
Create a new rotation which “un-does” this rotation. That is,
r * r.invert() is the identity. Read more
sourcefn rotate_point(&self, point: Self::Space) -> Self::Space
fn rotate_point(&self, point: Self::Space) -> Self::Space
Rotate a point using this rotation, by converting it to its representation as a vector. Read more
sourceimpl<S> Rotation3 for Quaternion<S> where
S: BaseFloat,
impl<S> Rotation3 for Quaternion<S> where
S: BaseFloat,
type Scalar = S
sourcefn from_axis_angle<A>(axis: Vector3<S>, angle: A) -> Quaternion<S> where
A: Into<Rad<S>>,
fn from_axis_angle<A>(axis: Vector3<S>, angle: A) -> Quaternion<S> where
A: Into<Rad<S>>,
Create a rotation using an angle around a given axis. Read more
sourcefn from_angle_x<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
fn from_angle_x<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
Create a rotation from an angle around the x axis (pitch).
sourcefn from_angle_y<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
fn from_angle_y<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
Create a rotation from an angle around the y axis (yaw).
sourcefn from_angle_z<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
fn from_angle_z<A>(theta: A) -> Self where
A: Into<Rad<Self::Scalar>>,
Create a rotation from an angle around the z axis (roll).
sourceimpl<'a, 'b, S> Sub<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
impl<'a, 'b, S> Sub<&'a Quaternion<S>> for &'b Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the - operation. Read more
sourceimpl<'a, S> Sub<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<'a, S> Sub<&'a Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
Performs the - operation. Read more
sourceimpl<S> Sub<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Sub<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn sub(self, other: Quaternion<S>) -> Quaternion<S>
fn sub(self, other: Quaternion<S>) -> Quaternion<S>
Performs the - operation. Read more
sourceimpl<'a, S> Sub<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
impl<'a, S> Sub<Quaternion<S>> for &'a Quaternion<S> where
S: BaseFloat,
type Output = Quaternion<S>
type Output = Quaternion<S>
The resulting type after applying the - operator.
sourcefn sub(self, other: Quaternion<S>) -> Quaternion<S>
fn sub(self, other: Quaternion<S>) -> Quaternion<S>
Performs the - operation. Read more
sourceimpl<S> SubAssign<Quaternion<S>> for Quaternion<S> where
S: BaseFloat + SubAssign<S>,
impl<S> SubAssign<Quaternion<S>> for Quaternion<S> where
S: BaseFloat + SubAssign<S>,
sourcefn sub_assign(&mut self, other: Quaternion<S>)
fn sub_assign(&mut self, other: Quaternion<S>)
Performs the -= operation. Read more
sourceimpl<'a, S> Sum<&'a Quaternion<S>> for Quaternion<S> where
S: 'a + BaseFloat,
impl<'a, S> Sum<&'a Quaternion<S>> for Quaternion<S> where
S: 'a + BaseFloat,
sourcefn sum<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = &'a Quaternion<S>>,
fn sum<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = &'a Quaternion<S>>,
Method which takes an iterator and generates Self from the elements by
“summing up” the items. Read more
sourceimpl<S> Sum<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> Sum<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn sum<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = Quaternion<S>>,
fn sum<I>(iter: I) -> Quaternion<S> where
I: Iterator<Item = Quaternion<S>>,
Method which takes an iterator and generates Self from the elements by
“summing up” the items. Read more
sourceimpl<S> UlpsEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
impl<S> UlpsEq<Quaternion<S>> for Quaternion<S> where
S: BaseFloat,
sourcefn default_max_ulps() -> u32
fn default_max_ulps() -> u32
The default ULPs to tolerate when testing values that are far-apart. Read more
sourcefn ulps_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon,
max_ulps: u32
) -> bool
fn ulps_eq(
&self,
other: &Quaternion<S>,
epsilon: <S as AbsDiffEq<S>>::Epsilon,
max_ulps: u32
) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
sourceimpl<S> VectorSpace for Quaternion<S> where
S: BaseFloat,
impl<S> VectorSpace for Quaternion<S> where
S: BaseFloat,
sourceimpl<S> Zero for Quaternion<S> where
S: BaseFloat,
impl<S> Zero for Quaternion<S> where
S: BaseFloat,
impl<S> Copy for Quaternion<S> where
S: Copy,
impl<S> StructuralPartialEq for Quaternion<S>
Auto Trait Implementations
impl<S> RefUnwindSafe for Quaternion<S> where
S: RefUnwindSafe,
impl<S> Send for Quaternion<S> where
S: Send,
impl<S> Sync for Quaternion<S> where
S: Sync,
impl<S> Unpin for Quaternion<S> where
S: Unpin,
impl<S> UnwindSafe for Quaternion<S> where
S: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into)Uses borrowed data to replace owned data, usually by cloning. Read more
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more