[−][src]Struct gramit::quaternion::Quaternion
Fields
i: f32
j: f32
k: f32
r: f32
Methods
impl Quaternion
[src]
pub fn new(i: f32, j: f32, k: f32, r: f32) -> Quaternion
[src]
Construct a Quaternion
with the given components.
pub fn real(r: f32) -> Quaternion
[src]
Construct a Quaternion
with only a real part.
pub fn vector(vec: Vec3) -> Quaternion
[src]
Construct a Quaternion
with only a vector part.
pub fn real_vector(r: f32, vec: Vec3) -> Quaternion
[src]
Construct a Quaternion
with the given real and vector parts.
pub fn vector_part(&self) -> Vec3
[src]
Get the imaginary components of this Quaternion
as a Vec3
.
pub fn conjugate_by(&self, q: &Quaternion) -> Quaternion
[src]
Conjugate this Quaternion
by q
.
pub fn conjugate_by_unit(&self, q: &Quaternion) -> Quaternion
[src]
Conjugate this Quaternion
by q
, which is assumed to be of unit magnitude.
This function takes advantage of the fact that, for unit quaternions, the inverse is equal
to the complex conjugate, and so omits several floating point operations in the calculation
of q
's inverse.
Usage Warning
This function does not check that q
is of unit magnitude! Doing so would require the
same operations that the unit-magnitude assumption avoids. The user should be sure that q
is actually a unit quaternion, or simply use conjugate_by
, which performs the full
calculation for inverting q
.
pub fn inverse(&self) -> Quaternion
[src]
Get the multiplicative inverse of this Quaternion
.
pub fn neg_vector(&self) -> Quaternion
[src]
Get a Quaternion
that is equal to this Quaternion
with its vector part negated
(i.e. the complex conjugate).
For a unit quaternion, this is equal to the inverse.
pub fn magnitude(&self) -> f32
[src]
Get the magnitude of this Quaternion
.
pub fn unit(&self) -> Quaternion
[src]
Get the normalized (unit-magnitude) version of this Quaternion
.
Trait Implementations
impl ApproxEq<Quaternion> for Quaternion
[src]
fn approx_eq(self, rhs: Quaternion) -> bool
[src]
fn within_threshold(self, rhs: Quaternion, threshold: Quaternion) -> bool
[src]
Compare two Quaternion
s for approximate equality.
Uses a third Quaternion
for element-wise thresholds.
impl From<f32> for Quaternion
[src]
fn from(r: f32) -> Quaternion
[src]
Converts an f32
into a Quaternion
with only a real part.
This conversion is identical to that performed by Quaternion::real
.
impl From<Vec3> for Quaternion
[src]
fn from(vec: Vec3) -> Quaternion
[src]
Converts a Vec3
into a Quaternion
with only a vector part.
This conversion is identical to that performed by Quaternion::vector
.
impl Clone for Quaternion
[src]
fn clone(&self) -> Quaternion
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Quaternion
[src]
impl PartialEq<Quaternion> for Quaternion
[src]
fn eq(&self, other: &Quaternion) -> bool
[src]
fn ne(&self, other: &Quaternion) -> bool
[src]
impl Debug for Quaternion
[src]
impl Div<Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the /
operator.
fn div(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_> Div<&'_ Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the /
operator.
fn div(self, rhs: &Quaternion) -> Quaternion
[src]
impl<'_> Div<Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the /
operator.
fn div(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_, '_> Div<&'_ Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the /
operator.
fn div(self, rhs: &Quaternion) -> Quaternion
[src]
impl Sub<Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn sub(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_> Sub<&'_ Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn sub(self, rhs: &Quaternion) -> Quaternion
[src]
impl<'_> Sub<Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn sub(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_, '_> Sub<&'_ Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn sub(self, rhs: &Quaternion) -> Quaternion
[src]
impl Add<Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the +
operator.
fn add(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_> Add<&'_ Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the +
operator.
fn add(self, rhs: &Quaternion) -> Quaternion
[src]
impl<'_> Add<Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the +
operator.
fn add(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_, '_> Add<&'_ Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the +
operator.
fn add(self, rhs: &Quaternion) -> Quaternion
[src]
impl Mul<Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the *
operator.
fn mul(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_> Mul<&'_ Quaternion> for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the *
operator.
fn mul(self, rhs: &Quaternion) -> Quaternion
[src]
impl<'_> Mul<Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the *
operator.
fn mul(self, rhs: Quaternion) -> Quaternion
[src]
impl<'_, '_> Mul<&'_ Quaternion> for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the *
operator.
fn mul(self, rhs: &Quaternion) -> Quaternion
[src]
impl Neg for Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn neg(self) -> Quaternion
[src]
impl<'_> Neg for &'_ Quaternion
[src]
type Output = Quaternion
The resulting type after applying the -
operator.
fn neg(self) -> Quaternion
[src]
impl AddAssign<Quaternion> for Quaternion
[src]
fn add_assign(&mut self, rhs: Quaternion)
[src]
impl<'_> AddAssign<&'_ Quaternion> for Quaternion
[src]
fn add_assign(&mut self, rhs: &Quaternion)
[src]
impl SubAssign<Quaternion> for Quaternion
[src]
fn sub_assign(&mut self, rhs: Quaternion)
[src]
impl<'_> SubAssign<&'_ Quaternion> for Quaternion
[src]
fn sub_assign(&mut self, rhs: &Quaternion)
[src]
impl MulAssign<Quaternion> for Quaternion
[src]
fn mul_assign(&mut self, rhs: Quaternion)
[src]
impl<'_> MulAssign<&'_ Quaternion> for Quaternion
[src]
fn mul_assign(&mut self, rhs: &Quaternion)
[src]
impl DivAssign<Quaternion> for Quaternion
[src]
fn div_assign(&mut self, rhs: Quaternion)
[src]
impl<'_> DivAssign<&'_ Quaternion> for Quaternion
[src]
fn div_assign(&mut self, rhs: &Quaternion)
[src]
impl StructuralPartialEq for Quaternion
[src]
Auto Trait Implementations
impl Send for Quaternion
impl Sync for Quaternion
impl Unpin for Quaternion
impl UnwindSafe for Quaternion
impl RefUnwindSafe for Quaternion
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,