Struct cgmath::Quaternion [] [src]

#[repr(C)]
pub struct Quaternion<S> { pub s: S, pub v: Vector3<S>, }

A quaternion in scalar/vector form.

This type is marked as #[repr(C)].

Fields

The scalar part of the quaternion.

The vector part of the quaternion.

Methods

impl<S: BaseFloat> Quaternion<S>
[src]

Construct a new quaternion from one scalar component and three imaginary components.

Construct a new quaternion from a scalar and a vector.

Construct a new quaternion as a closest arc between two vectors

Return the closest rotation that turns src vector into dst.

The conjugate of the quaternion.

Do a normalized linear interpolation with other, by amount.

Spherical Linear Intoperlation

Return the spherical linear interpolation between the quaternion and other. Both quaternions should be normalized first.

Performance notes

The acos operation used in slerp is an expensive operation, so unless your quarternions are far away from each other it's generally more advisable to use nlerp when you know your rotations are going to be small.

impl<S: NumCast + Copy> Quaternion<S>
[src]

Component-wise casting to another type.

Trait Implementations

impl<S: BaseFloat> From<Matrix3<S>> for Quaternion<S>
[src]

Convert the matrix to a quaternion

impl<S: Copy> Copy for Quaternion<S>
[src]

impl<S: Clone> Clone for Quaternion<S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<S: Debug> Debug for Quaternion<S>
[src]

Formats the value using the given formatter.

impl<S: PartialEq> PartialEq for Quaternion<S>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl<S: BaseFloat> Zero for Quaternion<S>
[src]

Returns the additive identity element of Self, 0. Read more

Returns true if self is equal to the additive identity.

impl<S: BaseFloat> One for Quaternion<S>
[src]

Returns the multiplicative identity element of Self, 1. Read more

impl<S: BaseFloat> Sum<Quaternion<S>> for Quaternion<S>
[src]

Method which takes an iterator and generates Self from the elements by "summing up" the items. Read more

impl<'a, S: 'a + BaseFloat> Sum<&'a Quaternion<S>> for Quaternion<S>
[src]

Method which takes an iterator and generates Self from the elements by "summing up" the items. Read more

impl<S: BaseFloat> Product<Quaternion<S>> for Quaternion<S>
[src]

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

impl<'a, S: 'a + BaseFloat> Product<&'a Quaternion<S>> for Quaternion<S>
[src]

Method which takes an iterator and generates Self from the elements by multiplying the items. Read more

impl<S: BaseFloat> VectorSpace for Quaternion<S>
[src]

The associated scalar.

impl<S: BaseFloat> MetricSpace for Quaternion<S>
[src]

The metric to be returned by the distance function.

Returns the squared distance. Read more

The distance between two values.

impl<S: BaseFloat> InnerSpace for Quaternion<S>
[src]

Vector dot (or inner) product.

Returns true if the vector is perpendicular (at right angles) to the other vector. Read more

Returns the squared magnitude. Read more

The distance from the tail to the tip of the vector.

Returns the angle between two vectors in radians.

Returns a vector with the same direction, but with a magnitude of 1.

Returns a vector with the same direction and a given magnitude.

Returns the result of linearly interpolating the magnitude of the vector towards the magnitude of other by the specified amount. Read more

impl<A> From<Euler<A>> for Quaternion<A::Unitless> where
    A: Angle + Into<Rad<<A as Angle>::Unitless>>, 
[src]

Performs the conversion.

impl<S: BaseFloat> Neg for Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<'a, S: BaseFloat> Neg for &'a Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the unary - operator

impl<S: BaseFloat> Mul<S> for Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseFloat> Mul<S> for &'a Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<S: BaseFloat + MulAssign<S>> MulAssign<S> for Quaternion<S>
[src]

The method for the *= operator

impl<S: BaseFloat> Div<S> for Quaternion<S>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<'a, S: BaseFloat> Div<S> for &'a Quaternion<S>
[src]

The resulting type after applying the / operator

The method for the / operator

impl<S: BaseFloat + DivAssign<S>> DivAssign<S> for Quaternion<S>
[src]

The method for the /= operator

impl<S: BaseFloat> Rem<S> for Quaternion<S>
[src]

The resulting type after applying the % operator

The method for the % operator

impl<'a, S: BaseFloat> Rem<S> for &'a Quaternion<S>
[src]

The resulting type after applying the % operator

The method for the % operator

impl<S: BaseFloat + RemAssign<S>> RemAssign<S> for Quaternion<S>
[src]

The method for the %= operator

impl<S: BaseFloat> Mul<Vector3<S>> for Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseFloat> Mul<&'a Vector3<S>> for Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseFloat> Mul<Vector3<S>> for &'a Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, S: BaseFloat> Mul<&'a Vector3<S>> for &'b Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<S: BaseFloat> Add<Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, S: BaseFloat> Add<&'a Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, S: BaseFloat> Add<Quaternion<S>> for &'a Quaternion<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<'a, 'b, S: BaseFloat> Add<&'a Quaternion<S>> for &'b Quaternion<S>
[src]

The resulting type after applying the + operator

The method for the + operator

impl<S: BaseFloat + AddAssign<S>> AddAssign<Quaternion<S>> for Quaternion<S>
[src]

The method for the += operator

impl<S: BaseFloat> Sub<Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, S: BaseFloat> Sub<&'a Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, S: BaseFloat> Sub<Quaternion<S>> for &'a Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<'a, 'b, S: BaseFloat> Sub<&'a Quaternion<S>> for &'b Quaternion<S>
[src]

The resulting type after applying the - operator

The method for the - operator

impl<S: BaseFloat + SubAssign<S>> SubAssign<Quaternion<S>> for Quaternion<S>
[src]

The method for the -= operator

impl<S: BaseFloat> Mul<Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseFloat> Mul<&'a Quaternion<S>> for Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, S: BaseFloat> Mul<Quaternion<S>> for &'a Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<'a, 'b, S: BaseFloat> Mul<&'a Quaternion<S>> for &'b Quaternion<S>
[src]

The resulting type after applying the * operator

The method for the * operator

impl<S: BaseFloat> ApproxEq for Quaternion<S>
[src]

Used for specifying relative comparisons.

The default tolerance to use when testing values that are close together. Read more

The default relative tolerance for testing values that are far-apart. Read more

The default ULPs to tolerate when testing values that are far-apart. Read more

A test for equality that uses a relative comparison if the values are far apart.

A test for equality that uses units in the last place (ULP) if the values are far apart.

The inverse of ApproxEq::relative_eq.

The inverse of ApproxEq::ulps_eq.

impl<S: BaseFloat> Rotation<Point3<S>> for Quaternion<S>
[src]

Create a rotation to a given direction with an 'up' vector.

Create a shortest rotation to transform vector 'a' into 'b'. Both given vectors are assumed to have unit length. Read more

Rotate a vector using this rotation.

Create a new rotation which "un-does" this rotation. That is, r * r.invert() is the identity. Read more

Rotate a point using this rotation, by converting it to its representation as a vector. Read more

impl<S: BaseFloat> Rotation3<S> for Quaternion<S>
[src]

Create a rotation using an angle around a given axis. Read more

Create a rotation from an angle around the x axis (pitch).

Create a rotation from an angle around the y axis (yaw).

Create a rotation from an angle around the z axis (roll).

impl<S: BaseFloat> Into<[S; 4]> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> AsRef<[S; 4]> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> AsMut<[S; 4]> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> From<[S; 4]> for Quaternion<S>
[src]

Performs the conversion.

impl<'a, S: BaseFloat> From<&'a [S; 4]> for &'a Quaternion<S>
[src]

Performs the conversion.

impl<'a, S: BaseFloat> From<&'a mut [S; 4]> for &'a mut Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> Into<(S, S, S, S)> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> AsRef<(S, S, S, S)> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> AsMut<(S, S, S, S)> for Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> From<(S, S, S, S)> for Quaternion<S>
[src]

Performs the conversion.

impl<'a, S: BaseFloat> From<&'a (S, S, S, S)> for &'a Quaternion<S>
[src]

Performs the conversion.

impl<'a, S: BaseFloat> From<&'a mut (S, S, S, S)> for &'a mut Quaternion<S>
[src]

Performs the conversion.

impl<S: BaseFloat> Index<usize> for Quaternion<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S: BaseFloat> IndexMut<usize> for Quaternion<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S: BaseFloat> Index<Range<usize>> for Quaternion<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S: BaseFloat> IndexMut<Range<usize>> for Quaternion<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S: BaseFloat> Index<RangeTo<usize>> for Quaternion<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S: BaseFloat> IndexMut<RangeTo<usize>> for Quaternion<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S: BaseFloat> Index<RangeFrom<usize>> for Quaternion<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S: BaseFloat> IndexMut<RangeFrom<usize>> for Quaternion<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S: BaseFloat> Index<RangeFull> for Quaternion<S>
[src]

The returned type after indexing

The method for the indexing (container[index]) operation

impl<S: BaseFloat> IndexMut<RangeFull> for Quaternion<S>
[src]

The method for the mutable indexing (container[index]) operation

impl<S: BaseFloat + Rand> Rand for Quaternion<S>
[src]

Generates a random instance of this type using the specified source of randomness. Read more

impl<S: BaseFloat> From<Basis3<S>> for Quaternion<S>
[src]

Performs the conversion.