#[repr(C)]pub struct Quat<F>where
F: Float,{ /* private fields */ }
Implementations§
Source§impl<F> Quat<F>where
F: Float,
impl<F> Quat<F>where
F: Float,
Sourcepub fn new_vector(v: Vec3<F>) -> Self
pub fn new_vector(v: Vec3<F>) -> Self
Creates new quaternion with v
as vector part and 0
for scalar.
Sourcepub fn new_axis_rotation(axis: Vec3<F>, angle: F) -> Self
pub fn new_axis_rotation(axis: Vec3<F>, angle: F) -> Self
Creates new quaternion that represents a rotation around axis
by angle
radians.
Method can accept denormalized input.
Sourcepub fn new_dst_rotation(from: Vec3<F>, to: Vec3<F>) -> Self
pub fn new_dst_rotation(from: Vec3<F>, to: Vec3<F>) -> Self
Creates new quaternion that represents a rotation that moves vector from
to vector to
.
Sourcepub fn into_axis_angle(self) -> (Vec3<F>, F)
pub fn into_axis_angle(self) -> (Vec3<F>, F)
Recovers angle axis representation of the quaternion.
Sourcepub fn rotate(&self, v: Vec3<F>) -> Vec3<F>
pub fn rotate(&self, v: Vec3<F>) -> Vec3<F>
Rotates vector v
by the rotation defined by this quaternion.
Sourcepub fn from_parts(x: F, y: F, z: F, w: F) -> Self
pub fn from_parts(x: F, y: F, z: F, w: F) -> Self
Creates new quaternion from individual parts.
Sourcepub fn normalize(&self) -> Self
pub fn normalize(&self) -> Self
Normalizes quaternion preserving direction but reducing its norm to 1
.
Sourcepub fn reciprocal(&self) -> Self
pub fn reciprocal(&self) -> Self
Computes the reciprocal of the quaternion.
Trait Implementations§
Source§impl<F> AddAssign for Quat<F>where
F: Float,
impl<F> AddAssign for Quat<F>where
F: Float,
Source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moreSource§impl<F> DivAssign<F> for Quat<F>where
F: Float,
impl<F> DivAssign<F> for Quat<F>where
F: Float,
Source§fn div_assign(&mut self, rhs: F)
fn div_assign(&mut self, rhs: F)
Performs the
/=
operation. Read moreSource§impl<F> MulAssign<F> for Quat<F>where
F: Float,
impl<F> MulAssign<F> for Quat<F>where
F: Float,
Source§fn mul_assign(&mut self, rhs: F)
fn mul_assign(&mut self, rhs: F)
Performs the
*=
operation. Read moreSource§impl<F> SubAssign for Quat<F>where
F: Float,
impl<F> SubAssign for Quat<F>where
F: Float,
Source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moreimpl<F> Copy for Quat<F>
impl<F> StructuralPartialEq for Quat<F>where
F: Float,
Auto Trait Implementations§
impl<F> Freeze for Quat<F>where
F: Freeze,
impl<F> RefUnwindSafe for Quat<F>where
F: RefUnwindSafe,
impl<F> Send for Quat<F>where
F: Send,
impl<F> Sync for Quat<F>where
F: Sync,
impl<F> Unpin for Quat<F>where
F: Unpin,
impl<F> UnwindSafe for Quat<F>where
F: UnwindSafe,
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