#[repr(C)]pub struct Vector4 {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}Fields§
§x: f32§y: f32§z: f32§w: f32Implementations§
Source§impl Vector4
impl Vector4
Sourcepub const fn new(x: f32, y: f32, z: f32, w: f32) -> Vector4
pub const fn new(x: f32, y: f32, z: f32, w: f32) -> Vector4
Returns a new Quaternion with specified components.
Sourcepub fn from_vec3_pair(from: Vector3, to: Vector3) -> Vector4
pub fn from_vec3_pair(from: Vector3, to: Vector3) -> Vector4
Returns quaternion based on the rotation from one vector to another.
Sourcepub fn from_matrix(mat: Matrix) -> Vector4
pub fn from_matrix(mat: Matrix) -> Vector4
Returns a quaternion for a given rotation matrix.
Sourcepub fn from_euler(pitch: f32, yaw: f32, roll: f32) -> Vector4
pub fn from_euler(pitch: f32, yaw: f32, roll: f32) -> Vector4
Returns a quaternion equivalent to Euler angles.
Sourcepub fn to_euler(&self) -> Vector3
pub fn to_euler(&self) -> Vector3
Returns a vector containing Euler angles in radians (roll, pitch, yaw), based on the current quaternion.
Sourcepub fn from_axis_angle(axis: Vector3, angle: f32) -> Vector4
pub fn from_axis_angle(axis: Vector3, angle: f32) -> Vector4
Returns rotation quaternion for an axis and angle (in radians).
Sourcepub fn to_axis_angle(&self) -> (Vector3, f32)
pub fn to_axis_angle(&self) -> (Vector3, f32)
Returns a 2-tuple containing the axis (Vector3) and angle (f32 in radians) for the current quaternion.
Sourcepub fn normalized(&self) -> Vector4
pub fn normalized(&self) -> Vector4
Returns a normalized version of the current quaternion.
Sourcepub fn lerp(&self, q: Vector4, amount: f32) -> Vector4
pub fn lerp(&self, q: Vector4, amount: f32) -> Vector4
Calculates linear interpolation between current and q quaternions.
Sourcepub fn nlerp(&self, q: Vector4, amount: f32) -> Vector4
pub fn nlerp(&self, q: Vector4, amount: f32) -> Vector4
Calculates slerp-optimized interpolation between current and q quaternions.
Sourcepub fn slerp(&self, q: Vector4, amount: f32) -> Vector4
pub fn slerp(&self, q: Vector4, amount: f32) -> Vector4
Calculates spherical linear interpolation between current and q quaternions.
Trait Implementations§
Source§impl MulAssign for Vector4
impl MulAssign for Vector4
Source§fn mul_assign(&mut self, q: Vector4)
fn mul_assign(&mut self, q: Vector4)
*= operation. Read more