[−][src]Struct duku::Quat
Compact 3D rotation representation.
Used for rotating vectors
Examples
let vector = Vec3::up(); let quat = Quat::euler_rotation(0.0, 0.0, 90.0); let rotated = quat * vector;
Fields
x: f32
the X component
y: f32
the Y component
z: f32
the Z component
w: f32
the W component
Implementations
impl Quat
[src]
pub const fn new(x: f32, y: f32, z: f32, w: f32) -> Self
[src]
Create quaternion
pub fn euler_rotation(x: f32, y: f32, z: f32) -> Self
[src]
Create quaternion with euler angles
This rotation's yaw, pitch and roll are z, y and x
pub fn axis_rotation(axis: impl Into<Vec3>, angle: f32) -> Self
[src]
Create quaternion around axis
This rotates vectors around axis by the angle
pub fn look_rotation(dir: impl Into<Vec3>, global_up: impl Into<Vec3>) -> Self
[src]
Create quaternion to rotate towards direction
global_up
is used as a guide to try aligning to
pub fn local_up(self) -> Vec3
[src]
local up direction for transformation
pub fn local_forward(self) -> Vec3
[src]
local forward direction for transformation
pub fn local_right(self) -> Vec3
[src]
local right direction for transformation
pub fn inverse(self) -> Quat
[src]
Calculate the inverse rotation
Trait Implementations
impl Clone for Quat
[src]
impl Copy for Quat
[src]
impl Debug for Quat
[src]
impl Default for Quat
[src]
impl From<[f32; 4]> for Quat
[src]
impl From<Mat4> for Quat
[src]
impl From<Quat> for Mat4
[src]
impl Mul<Quat> for Quat
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Self) -> Self
[src]
impl Mul<Vec3> for Quat
[src]
type Output = Vec3
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vec3) -> Vec3
[src]
impl MulAssign<Quat> for Quat
[src]
pub fn mul_assign(&mut self, rhs: Self)
[src]
impl PartialEq<Quat> for Quat
[src]
impl StructuralPartialEq for Quat
[src]
Auto Trait Implementations
impl RefUnwindSafe for Quat
impl Send for Quat
impl Sync for Quat
impl Unpin for Quat
impl UnwindSafe for Quat
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,