Struct truck_geometry::base::cgmath::Quaternion
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: S
The scalar part of the quaternion.
Implementations§
§impl<S> Quaternion<S>
impl<S> Quaternion<S>
pub 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.
pub 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.
§impl<S> Quaternion<S>where
S: BaseFloat,
impl<S> Quaternion<S>where
S: BaseFloat,
pub 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)
pub fn conjugate(self) -> Quaternion<S>
pub fn conjugate(self) -> Quaternion<S>
The conjugate of the quaternion.
pub 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
.
pub 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
§impl<S> Quaternion<S>where
S: NumCast + Copy,
impl<S> Quaternion<S>where
S: NumCast + Copy,
pub 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§
§impl<S> AbsDiffEq<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> AbsDiffEq<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
§fn default_epsilon() -> <S as AbsDiffEq<S>>::Epsilon
fn default_epsilon() -> <S as AbsDiffEq<S>>::Epsilon
§fn 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
§fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
AbsDiffEq::abs_diff_eq
.§impl<'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>
+
operator.§fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
+
operation. Read more§impl<'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>
+
operator.§fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn add(self, other: &'a Quaternion<S>) -> Quaternion<S>
+
operation. Read more§impl<'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>
+
operator.§fn add(self, other: Quaternion<S>) -> Quaternion<S>
fn add(self, other: Quaternion<S>) -> Quaternion<S>
+
operation. Read more§impl<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>
+
operator.§fn add(self, other: Quaternion<S>) -> Quaternion<S>
fn add(self, other: Quaternion<S>) -> Quaternion<S>
+
operation. Read more§impl<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>,
§fn add_assign(&mut self, other: Quaternion<S>)
fn add_assign(&mut self, other: Quaternion<S>)
+=
operation. Read more§impl<S> AsMut<[S; 4]> for Quaternion<S>where
S: BaseFloat,
impl<S> AsMut<[S; 4]> for Quaternion<S>where
S: BaseFloat,
§impl<S> AsMut<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
impl<S> AsMut<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
§fn as_mut(&mut self) -> &mut (S, S, S, S)
fn as_mut(&mut self) -> &mut (S, S, S, S)
§impl<S> AsRef<[S; 4]> for Quaternion<S>where
S: BaseFloat,
impl<S> AsRef<[S; 4]> for Quaternion<S>where
S: BaseFloat,
§impl<S> AsRef<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
impl<S> AsRef<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
§fn as_ref(&self) -> &(S, S, S, S)
fn as_ref(&self) -> &(S, S, S, S)
§impl<S> Clone for Quaternion<S>where
S: Clone,
impl<S> Clone for Quaternion<S>where
S: Clone,
§fn clone(&self) -> Quaternion<S>
fn clone(&self) -> Quaternion<S>
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl<S> Debug for Quaternion<S>where
S: Debug,
impl<S> Debug for Quaternion<S>where
S: Debug,
§impl<'de, S> Deserialize<'de> for Quaternion<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Quaternion<S>where
S: Deserialize<'de>,
§fn deserialize<__D>(
__deserializer: __D
) -> Result<Quaternion<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Quaternion<S>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl<'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>
/
operator.§fn div(self, other: S) -> Quaternion<S>
fn div(self, other: S) -> Quaternion<S>
/
operation. Read more§impl<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>
/
operator.§fn div(self, other: S) -> Quaternion<S>
fn div(self, other: S) -> Quaternion<S>
/
operation. Read more§impl<S> DivAssign<S> for Quaternion<S>where
S: BaseFloat + DivAssign<S>,
impl<S> DivAssign<S> for Quaternion<S>where
S: BaseFloat + DivAssign<S>,
§fn div_assign(&mut self, scalar: S)
fn div_assign(&mut self, scalar: S)
/=
operation. Read more§impl<'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,
§fn from(v: &'a [S; 4]) -> &'a Quaternion<S>
fn from(v: &'a [S; 4]) -> &'a Quaternion<S>
§impl<'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,
§fn from(v: &'a (S, S, S, S)) -> &'a Quaternion<S>
fn from(v: &'a (S, S, S, S)) -> &'a Quaternion<S>
§impl<'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,
§fn from(v: &'a mut [S; 4]) -> &'a mut Quaternion<S>
fn from(v: &'a mut [S; 4]) -> &'a mut Quaternion<S>
§impl<'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,
§fn 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>
§impl<S> From<[S; 4]> for Quaternion<S>where
S: BaseFloat,
impl<S> From<[S; 4]> for Quaternion<S>where
S: BaseFloat,
§fn from(v: [S; 4]) -> Quaternion<S>
fn from(v: [S; 4]) -> Quaternion<S>
§impl<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,
§fn from(v: (S, S, S, S)) -> Quaternion<S>
fn from(v: (S, S, S, S)) -> Quaternion<S>
§impl<S> From<Basis3<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> From<Basis3<S>> for Quaternion<S>where
S: BaseFloat,
§fn from(b: Basis3<S>) -> Quaternion<S>
fn from(b: Basis3<S>) -> Quaternion<S>
§impl<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>>,
§impl<S> From<Matrix3<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> From<Matrix3<S>> for Quaternion<S>where
S: BaseFloat,
§fn from(mat: Matrix3<S>) -> Quaternion<S>
fn from(mat: Matrix3<S>) -> Quaternion<S>
Convert the matrix to a quaternion
§impl<S> From<Quaternion<S>> for Basis3<S>where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Basis3<S>where
S: BaseFloat,
§fn from(quat: Quaternion<S>) -> Basis3<S>
fn from(quat: Quaternion<S>) -> Basis3<S>
§impl<S> From<Quaternion<S>> for Euler<Rad<S>>where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Euler<Rad<S>>where
S: BaseFloat,
§fn from(src: Quaternion<S>) -> Euler<Rad<S>>
fn from(src: Quaternion<S>) -> Euler<Rad<S>>
§impl<S> From<Quaternion<S>> for Matrix3<S>where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Matrix3<S>where
S: BaseFloat,
§fn from(quat: Quaternion<S>) -> Matrix3<S>
fn from(quat: Quaternion<S>) -> Matrix3<S>
Convert the quaternion to a 3 x 3 rotation matrix.
§impl<S> From<Quaternion<S>> for Matrix4<S>where
S: BaseFloat,
impl<S> From<Quaternion<S>> for Matrix4<S>where
S: BaseFloat,
§fn from(quat: Quaternion<S>) -> Matrix4<S>
fn from(quat: Quaternion<S>) -> Matrix4<S>
Convert the quaternion to a 4 x 4 rotation matrix.
§impl<S> Index<RangeFull> for Quaternion<S>where
S: BaseFloat,
impl<S> Index<RangeFull> for Quaternion<S>where
S: BaseFloat,
§impl<S> Index<usize> for Quaternion<S>where
S: BaseFloat,
impl<S> Index<usize> for Quaternion<S>where
S: BaseFloat,
§impl<S> IndexMut<RangeFull> for Quaternion<S>where
S: BaseFloat,
impl<S> IndexMut<RangeFull> for Quaternion<S>where
S: BaseFloat,
§impl<S> IndexMut<usize> for Quaternion<S>where
S: BaseFloat,
impl<S> IndexMut<usize> for Quaternion<S>where
S: BaseFloat,
§impl<S> InnerSpace for Quaternion<S>where
S: BaseFloat,
impl<S> InnerSpace for Quaternion<S>where
S: BaseFloat,
§fn dot(self, other: Quaternion<S>) -> S
fn dot(self, other: Quaternion<S>) -> S
§fn magnitude2(self) -> Self::Scalar
fn magnitude2(self) -> Self::Scalar
§fn angle(self, other: Self) -> Rad<Self::Scalar>where
Self::Scalar: BaseFloat,
fn angle(self, other: Self) -> Rad<Self::Scalar>where
Self::Scalar: BaseFloat,
§fn project_on(self, other: Self) -> Self
fn project_on(self, other: Self) -> Self
§impl<S> Into<[S; 4]> for Quaternion<S>where
S: BaseFloat,
impl<S> Into<[S; 4]> for Quaternion<S>where
S: BaseFloat,
§impl<S> Into<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
impl<S> Into<(S, S, S, S)> for Quaternion<S>where
S: BaseFloat,
§fn into(self) -> (S, S, S, S)
fn into(self) -> (S, S, S, S)
§impl<S> MetricSpace for Quaternion<S>where
S: BaseFloat,
impl<S> MetricSpace for Quaternion<S>where
S: BaseFloat,
§impl<'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>
*
operator.§fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
*
operation. Read more§impl<'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>
*
operator.§fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn mul(self, other: &'a Quaternion<S>) -> Quaternion<S>
*
operation. Read more§impl<'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,
§impl<'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,
§impl<'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>
*
operator.§fn mul(self, other: Quaternion<S>) -> Quaternion<S>
fn mul(self, other: Quaternion<S>) -> Quaternion<S>
*
operation. Read more§impl<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>
*
operator.§fn mul(self, other: Quaternion<S>) -> Quaternion<S>
fn mul(self, other: Quaternion<S>) -> Quaternion<S>
*
operation. Read more§impl<'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>
*
operator.§fn mul(self, other: S) -> Quaternion<S>
fn mul(self, other: S) -> Quaternion<S>
*
operation. Read more§impl<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>
*
operator.§fn mul(self, other: S) -> Quaternion<S>
fn mul(self, other: S) -> Quaternion<S>
*
operation. Read more§impl<'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,
§impl<S> Mul<Vector3<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> Mul<Vector3<S>> for Quaternion<S>where
S: BaseFloat,
§impl<S> MulAssign<S> for Quaternion<S>where
S: BaseFloat + MulAssign<S>,
impl<S> MulAssign<S> for Quaternion<S>where
S: BaseFloat + MulAssign<S>,
§fn mul_assign(&mut self, scalar: S)
fn mul_assign(&mut self, scalar: S)
*=
operation. Read more§impl<'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>
-
operator.§fn neg(self) -> Quaternion<S>
fn neg(self) -> Quaternion<S>
-
operation. Read more§impl<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>
-
operator.§fn neg(self) -> Quaternion<S>
fn neg(self) -> Quaternion<S>
-
operation. Read more§impl<S> One for Quaternion<S>where
S: BaseFloat,
impl<S> One for Quaternion<S>where
S: BaseFloat,
§fn one() -> Quaternion<S>
fn one() -> Quaternion<S>
§impl<S> PartialEq<Quaternion<S>> for Quaternion<S>where
S: PartialEq<S>,
impl<S> PartialEq<Quaternion<S>> for Quaternion<S>where
S: PartialEq<S>,
§fn eq(&self, other: &Quaternion<S>) -> bool
fn eq(&self, other: &Quaternion<S>) -> bool
self
and other
values to be equal, and is used
by ==
.§impl<'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,
§fn 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>>,
Self
from the elements by
multiplying the items.§impl<S> Product<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> Product<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
§fn 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>>,
Self
from the elements by
multiplying the items.§impl<S> RelativeEq<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> RelativeEq<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
§fn default_max_relative() -> <S as AbsDiffEq<S>>::Epsilon
fn default_max_relative() -> <S as AbsDiffEq<S>>::Epsilon
§fn 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
§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
RelativeEq::relative_eq
.§impl<'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>
%
operator.§fn rem(self, other: S) -> Quaternion<S>
fn rem(self, other: S) -> Quaternion<S>
%
operation. Read more§impl<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>
%
operator.§fn rem(self, other: S) -> Quaternion<S>
fn rem(self, other: S) -> Quaternion<S>
%
operation. Read more§impl<S> RemAssign<S> for Quaternion<S>where
S: BaseFloat + RemAssign<S>,
impl<S> RemAssign<S> for Quaternion<S>where
S: BaseFloat + RemAssign<S>,
§fn rem_assign(&mut self, scalar: S)
fn rem_assign(&mut self, scalar: S)
%=
operation. Read more§impl<S> Rotation for Quaternion<S>where
S: BaseFloat,
impl<S> Rotation for Quaternion<S>where
S: BaseFloat,
§fn 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>
§fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>
fn look_at(dir: Vector3<S>, up: Vector3<S>) -> Quaternion<S>
§fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>
fn between_vectors(a: Vector3<S>, b: Vector3<S>) -> Quaternion<S>
§fn invert(&self) -> Quaternion<S>
fn invert(&self) -> Quaternion<S>
r * r.invert()
is the identity.§fn rotate_point(&self, point: Self::Space) -> Self::Space
fn rotate_point(&self, point: Self::Space) -> Self::Space
§impl<S> Rotation3 for Quaternion<S>where
S: BaseFloat,
impl<S> Rotation3 for Quaternion<S>where
S: BaseFloat,
type Scalar = S
§fn 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>>,
§fn from_angle_x<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
fn from_angle_x<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
x
axis (pitch).§fn from_angle_y<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
fn from_angle_y<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
y
axis (yaw).§fn from_angle_z<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
fn from_angle_z<A>(theta: A) -> Selfwhere
A: Into<Rad<Self::Scalar>>,
z
axis (roll).§impl<S> Serialize for Quaternion<S>where
S: Serialize,
impl<S> Serialize for Quaternion<S>where
S: Serialize,
§fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
§impl<'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>
-
operator.§fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
-
operation. Read more§impl<'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>
-
operator.§fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
fn sub(self, other: &'a Quaternion<S>) -> Quaternion<S>
-
operation. Read more§impl<'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>
-
operator.§fn sub(self, other: Quaternion<S>) -> Quaternion<S>
fn sub(self, other: Quaternion<S>) -> Quaternion<S>
-
operation. Read more§impl<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>
-
operator.§fn sub(self, other: Quaternion<S>) -> Quaternion<S>
fn sub(self, other: Quaternion<S>) -> Quaternion<S>
-
operation. Read more§impl<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>,
§fn sub_assign(&mut self, other: Quaternion<S>)
fn sub_assign(&mut self, other: Quaternion<S>)
-=
operation. Read more§impl<'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,
§fn 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>>,
Self
from the elements by
“summing up” the items.§impl<S> Sum<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
impl<S> Sum<Quaternion<S>> for Quaternion<S>where
S: BaseFloat,
§fn 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>>,
Self
from the elements by
“summing up” the items.