#[repr(C)]pub struct Quaternion<T> { /* private fields */ }
Expand description
Quaternion type
Implementations§
Source§impl<T> Quaternion<T>
impl<T> Quaternion<T>
Source§impl<T: Num + Copy> Quaternion<T>
impl<T: Num + Copy> Quaternion<T>
Sourcepub fn one() -> Quaternion<T>
pub fn one() -> Quaternion<T>
construct a unit Quaternion
Sourcepub fn new_from_vec(v: &V4<T>) -> Self
pub fn new_from_vec(v: &V4<T>) -> Self
Construct a new Quternion from a V4
Sourcepub fn to_rotation(&self) -> M33<T>
pub fn to_rotation(&self) -> M33<T>
convert the Quaternion to a rotation matrix
Source§impl<T: Float + Sum> Quaternion<T>
impl<T: Float + Sum> Quaternion<T>
Sourcepub fn from_rotation(rot: &M33<T>) -> Self
pub fn from_rotation(rot: &M33<T>) -> Self
convert a rotation matrix M33 to a Quaternion
Source§impl<T: Float> Quaternion<T>
impl<T: Float> Quaternion<T>
Sourcepub fn rotation(theta: T, vector: &V3<T>) -> Self
pub fn rotation(theta: T, vector: &V3<T>) -> Self
generate a Quaternion that represents a rotation of a angle theta
around the axis(normalized) v
Sourcepub fn rotation_norm_encoded(v: &V3<T>) -> Self
pub fn rotation_norm_encoded(v: &V3<T>) -> Self
generate a Quaternion that represents a rotation of a angle theta
around the axis(normalized) v
, the angle theta
is encoded in the
norm of the vector v
Sourcepub fn from_euler_angles(yay: T, pitch: T, roll: T) -> Self
pub fn from_euler_angles(yay: T, pitch: T, roll: T) -> Self
create a quaternion that represents the rotation from a Euler angles with the roll-pitch-yay convention
Sourcepub fn get_axis(&self) -> Option<V3<T>>
pub fn get_axis(&self) -> Option<V3<T>>
get the axis of rotation from which this Quaternion represent
Sourcepub fn axis_angle(&self) -> (Option<V3<T>>, T)
pub fn axis_angle(&self) -> (Option<V3<T>>, T)
combine the two previous methods: get_axis
and get_angle
Sourcepub fn normalize_q(&self) -> Self
pub fn normalize_q(&self) -> Self
normalize the Quaternion
Sourcepub fn slerp(a: Self, b: Self, t: T) -> Self
pub fn slerp(a: Self, b: Self, t: T) -> Self
Spherical Linear Interpolation between two Quaternions this implementation follow this implementations:
https://www.mrpt.org/tutorials/programming/maths-and-geometry/slerp-interpolation/
Function arguments:
a
: Quaternion(normalized)
b
: Quaternion(normalized)
t
: Float in the closed interval [0.0, 1.0]
Sourcepub fn derivative(&self, rate: &V3<T>) -> Self
pub fn derivative(&self, rate: &V3<T>) -> Self
Calculate the instantaneous Quaternion derivative representing a Quaternion rotating at rate given by a vector rate
Function arguments:
rate
: V3
Source§impl<T: Float + Signed> Quaternion<T>
impl<T: Float + Signed> Quaternion<T>
Source§impl<T: Float + FloatConst> Quaternion<T>
impl<T: Float + FloatConst> Quaternion<T>
Sourcepub fn to_euler_angles(&self) -> (T, T, T)
pub fn to_euler_angles(&self) -> (T, T, T)
get the euler angles from the Quaternion
Trait Implementations§
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 more