Quaternion
struct · ferroui-base · v0.5.0
struct Quaternion
A vector that is used to encode three-dimensional physical rotations.
Members
xyzwIDENTITYZEROnewfrom_vector3is_identityconcatenateconjugatecreate_from_axis_anglecreate_from_rotation_matrixcreate_from_yaw_pitch_rolldotinverselengthlength_squaredlerpnormalizeslerp
x
x: f32
The X value of the vector component of the quaternion.
y
y: f32
The Y value of the vector component of the quaternion.
z
z: f32
The Z value of the vector component of the quaternion.
w
w: f32
The rotation component of the quaternion.
IDENTITY
const IDENTITY: Quaternion
A quaternion that represents no rotation.
ZERO
const ZERO: Quaternion
A quaternion whose components are all zero.
new
const fn new(x: f32, y: f32, z: f32, w: f32) -> Self
Constructs a quaternion from the specified components.
from_vector3
const fn from_vector3(vector_part: Vector3, scalar_part: f32) -> Self
Creates a quaternion from the specified vector and rotation parts.
is_identity
fn is_identity(self: &Self) -> bool
Gets a value that indicates whether the current instance is the identity quaternion.
concatenate
fn concatenate(value1: Quaternion, value2: Quaternion) -> Quaternion
Concatenates two quaternions: the result represents the value1
rotation followed by the value2 rotation.
conjugate
fn conjugate(value: Quaternion) -> Quaternion
Returns the conjugate of a specified quaternion.
create_from_axis_angle
fn create_from_axis_angle(axis: Vector3, angle: f32) -> Quaternion
Creates a quaternion from a unit vector and an angle to rotate around the vector.
create_from_rotation_matrix
fn create_from_rotation_matrix(matrix: Matrix4x4) -> Quaternion
Creates a quaternion from the specified rotation matrix.
create_from_yaw_pitch_roll
fn create_from_yaw_pitch_roll(yaw: f32, pitch: f32, roll: f32) -> Quaternion
Creates a new quaternion from the given yaw, pitch, and roll.
dot
fn dot(quaternion1: Quaternion, quaternion2: Quaternion) -> f32
Calculates the dot product of two quaternions.
inverse
fn inverse(value: Quaternion) -> Quaternion
Returns the inverse of a quaternion.
length
fn length(self: &Self) -> f32
Calculates the length of the quaternion.
length_squared
fn length_squared(self: &Self) -> f32
Calculates the squared length of the quaternion.
lerp
fn lerp(quaternion1: Quaternion, quaternion2: Quaternion, amount: f32) -> Quaternion
Performs a linear interpolation between two quaternions based on a value that specifies the weighting of the second quaternion. The result is normalized.
normalize
fn normalize(value: Quaternion) -> Quaternion
Divides each component of a specified quaternion by its length.
slerp
fn slerp(quaternion1: Quaternion, quaternion2: Quaternion, amount: f32) -> Quaternion
Interpolates between two quaternions, using spherical linear interpolation.
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedToStringErasedDestructorIntoEitherCloneCopyDebugStructuralPartialEqPartialEqDefaultAddSubNegMulMul<f32>DivDisplayIInterpolator<Quaternion>From<Quaternion>ExpressionVariantValueServerPropertyValueBatchValue
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.