#[repr(C)]pub struct Quat {
pub x: f32,
pub y: f32,
pub z: f32,
pub w: f32,
}Expand description
Quaternion stored as vector part (x,y,z) followed by scalar part w.
Fields§
§x: f32§y: f32§z: f32§w: f32Implementations§
Source§impl Quat
impl Quat
pub const IDENTITY: Self
pub const NAN: Self
pub const fn from_xyzw(x: f32, y: f32, z: f32, w: f32) -> Self
pub const fn from_array(v: [f32; 4]) -> Self
pub const fn to_array(self) -> [f32; 4]
pub const fn from_vec4(v: Vec4) -> Self
pub const fn to_vec4(self) -> Vec4
pub const fn xyz(self) -> Vec3
Sourcepub fn from_axis_angle(axis: Vec3, angle: f32) -> Self
pub fn from_axis_angle(axis: Vec3, angle: f32) -> Self
Finite nonzero axes are normalized. A zero axis returns NaNs.
pub fn from_rotation_x(angle: f32) -> Self
pub fn from_rotation_y(angle: f32) -> Self
pub fn from_rotation_z(angle: f32) -> Self
pub fn from_euler(order: EulerRot, a: f32, b: f32, c: f32) -> Self
pub fn from_scaled_axis(axis: Vec3) -> Self
Sourcepub fn from_rotation_arc(from: Vec3, to: Vec3) -> Self
pub fn from_rotation_arc(from: Vec3, to: Vec3) -> Self
Shortest rotation between two finite nonzero directions.
pub fn to_axis_angle(self) -> (Vec3, f32)
pub fn to_scaled_axis(self) -> Vec3
pub fn dot(self, rhs: Self) -> f32
pub fn length_squared(self) -> f32
pub fn length(self) -> f32
pub fn is_finite(self) -> bool
pub fn is_nan(self) -> bool
pub fn is_normalized(self) -> bool
pub fn try_normalize(self) -> Option<Self>
pub fn normalize(self) -> Self
pub const fn conjugate(self) -> Self
Sourcepub fn try_inverse(self) -> Option<Self>
pub fn try_inverse(self) -> Option<Self>
Algebraic inverse, also correct for finite non-unit quaternions.
pub fn inverse(self) -> Self
Sourcepub fn mul_vec3(self, v: Vec3) -> Vec3
pub fn mul_vec3(self, v: Vec3) -> Vec3
Applies a unit quaternion rotation. Non-unit quaternions must be normalized first.
pub fn mul_quat(self, rhs: Self) -> Self
pub fn lerp(self, rhs: Self, t: f32) -> Self
Sourcepub fn slerp(self, rhs: Self, t: f32) -> Self
pub fn slerp(self, rhs: Self, t: f32) -> Self
Spherical interpolation follows the shortest rotation and normalizes endpoints.
pub fn angle_between(self, rhs: Self) -> f32
pub fn abs_diff_eq(self, rhs: Self, tolerance: f32) -> bool
pub fn rotate_towards(self, rhs: Self, max_angle: f32) -> Self
Trait Implementations§
Source§impl MulAssign for Quat
impl MulAssign for Quat
Source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*= operation. Read moreimpl Copy for Quat
impl StructuralPartialEq for Quat
Auto Trait Implementations§
impl Freeze for Quat
impl RefUnwindSafe for Quat
impl Send for Quat
impl Sync for Quat
impl Unpin for Quat
impl UnwindSafe for Quat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more