pub struct Quaternion { /* private fields */ }
Expand description

Quaternion

Compact way to represent rotations without gimbal lock.

Implements: Clone, Copy, PartialEq, Debug

Implementations

Create new Quaternion from given scalar and x y z values

Create new Quaternion from given scalar and Vector3

Create new Quaternion from f32;4

0 = scalar

1 2 3 = vector

Create new Quaternion from given euler angles (Vector3)

Angles in Radians

Get Quaternion rotation as euler angles

Angles in Radians

Note: if Quaternion was created from euler angles, this euler angles representation might not have the same values as the original

Get Quaternion values as f32 array

0 = scalar

1 2 3 = vector

Returns: Quaternion length without applying square root

alias: norm

Returns: Quaternion length without applying square root

alias: sqr_magnitude

Returns: Quaternion length

Returns: normalization result

Ok: if Quaternion’s norm is not zero.

Err: if Quaternion’s norm is zero.

Returns: new Quaternion with the same magtinude but the sign of the imaginary components flipped

Trait Implementations

The resulting type after applying the + operator.

Performs the + operation. Read more

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

The returned type after indexing.

Performs the indexing (container[index]) operation. Read more

Performs the mutable indexing (container[index]) operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

The resulting type after applying the * operator.

Performs the * operation. Read more

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

This method tests for !=.

The resulting type after applying the - operator.

Performs the - operation. 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.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

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.