#[repr(C)]
pub struct Quat { pub x: f32, pub y: f32, pub z: f32, pub w: f32, }
Expand description

Quaternion, used to represent 3D rotations.

Quaternions need to be normalized before all operations.

See also Quat in the Godot API doc.

Fields

x: f32y: f32z: f32w: f32

Implementations

Helper methods for Quat.

See the official Godot documentation.

The identity quaternion, representing no rotation. Equivalent to an identity Basis matrix. If a vector is transformed by an identity quaternion, it will not change.

Constructs a quaternion defined by the given values.

Constructs a quaternion from the given Basis

Constructs a quaternion that will perform a rotation specified by Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last), given in the vector format as (X angle, Y angle, Z angle).

Constructs a quaternion that will rotate around the given axis by the specified angle. The axis must be a normalized vector.

Performs a cubic spherical interpolation between quaternions pre_a, this quaternion, b, and post_b, by the given amount t.

Returns the dot product of two quaternions.

Returns Euler angles (in the YXZ convention: when decomposing, first Z, then X, and Y last) corresponding to the rotation represented by the unit quaternion. Returned vector contains the rotation angles in the format (X angle, Y angle, Z angle).

Returns the inverse of the quaternion.

Returns true if this quaternion and quat are approximately equal, by running is_equal_approx on each component

Returns whether the quaternion is normalized or not.

Returns the length of the quaternion.

Returns the length of the quaternion, squared.

Returns a copy of the quaternion, normalized to unit length.

Normalization is necessary before transforming vectors through xform() or *.

Returns the result of the spherical linear interpolation between this quaternion and to by amount weight.

Note: Both quaternions must be normalized.

Returns the result of the spherical linear interpolation between this quaternion and t by amount t, but without checking if the rotation path is not bigger than 90 degrees.

Returns a vector transformed (multiplied) by this quaternion. This is the same as mul

Note: The quaternion must be normalized.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Deserialize this value from the given Serde deserializer. Read more
A type-specific hint type that is valid for the type being exported. Read more
Returns ExportInfo given an optional typed hint.

Returns another quaternion transformed (multiplied) by this quaternion.

The resulting type after applying the * operator.

Returns a vector transformed (multiplied) by this quaternion. This is the same as xform

Note: The quaternion must be normalized.

The resulting type after applying the * operator.
The resulting type after applying the - operator.
Performs the unary - 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 default implementation is almost always sufficient, and should not be overridden without very good reason. Read more
Serialize this value into the given Serde serializer. 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
Uses borrowed data to replace owned data, usually by cloning. 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.