logo
pub struct Quaternion { /* private fields */ }

Implementations

A Quaternion

vector3

an allocated 3-float array

Initializes a quaternion that rotates angle degrees around the axis vector (x, y, z). The axis vector does not need to be normalized.

angle

The angle you want to rotate around the given axis

x

The x component of your axis vector about which you want to rotate.

y

The y component of your axis vector about which you want to rotate.

z

The z component of your axis vector about which you want to rotate.

Initializes a quaternion that rotates angle degrees around the given axis vector. The axis vector does not need to be normalized.

angle

The angle to rotate around axis3f

axis3f

your 3 component axis vector about which you want to rotate.

Initializes a [w (x, y,z)] quaternion directly from an array of 4 floats: w,x,y,z.

array

An array of 4 floats w,(x,y,z)

euler

A Euler with which to initialize the quaternion

Initializes a quaternion from a rotation matrix.

matrix

A rotation matrix with which to initialize the quaternion

src

A Quaternion with which to initialize self

XXX: check which direction this rotates

angle

The angle to rotate around the x axis

angle

The angle to rotate around the y axis

angle

The angle to rotate around the z axis

Initializes the quaternion with the canonical quaternion identity [1 (0, 0, 0)] which represents no rotation. Multiplying a quaternion with this identity leaves the quaternion unchanged.

You might also want to consider using get_static_identity_quaternion.

This combines the rotations of two quaternions into self. The operation is not commutative so the order is important because AxB != BxA. follows the standard convention for quaternions here so the rotations are applied right to left. This is similar to the combining of matrices.

It is possible to multiply the a quaternion in-place, so self can be equal to a but can’t be equal to b.

left

The second Quaternion rotation to apply

The first Quaternion rotation to apply

Performs a normalized linear interpolation between two quaternions. That is it does a linear interpolation of the quaternion components and then normalizes the result. This will follow the shortest arc between the two orientations (just like the slerp function) but will not progress at a constant speed. Unlike slerp nlerp is commutative which is useful if you are blending animations together. (I.e. nlerp (tmp, a, b) followed by nlerp (result, tmp, d) is the same as nlerp (tmp, a, d) followed by nlerp (result, tmp, b)). Finally nlerp is cheaper than slerp so it can be a good choice if you don’t need the constant speed property of the slerp function.

Notable properties:

commutative: Yes

constant velocity: No

torque minimal (travels along the surface of the 4-sphere): Yes

faster than Quaternion::slerp

a

The first Quaternion

b

The second Quaternion

t

The factor in the range 0..1 used to interpolate between quaterion a and b.

exponent

the exponent

Performs a spherical linear interpolation between two quaternions.

Noteable properties:

commutative: No

constant velocity: Yes

torque minimal (travels along the surface of the 4-sphere): Yes

more expensive than Quaternion::nlerp

a

The first Quaternion

b

The second Quaternion

t

The factor in the range 0..1 used to interpolate between quaternion a and b.

prev

A Quaternion used before a

a

The first Quaternion

b

The second Quaternion

next

A Quaternion that will be used after b

t

The factor in the range 0..1 used to interpolate between quaternion a and b.

Trait Implementations

Formats the value using the given formatter. Read more

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

This method tests for !=.

This method returns an ordering between self and other values if one exists. Read more

This method tests less than (for self and other) and is used by the < operator. Read more

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

This method tests greater than (for self and other) and is used by the > operator. Read more

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Typed getter

Inspect the context.

Inspect the context.

Inspect the context.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert into color

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Sets value as a parameter of self.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.