[−][src]Struct duku::Quaternion
Compact 3D rotation representation.
Used for rotating vectors
Example
ⓘThis example is not tested
let vector = Vector3::UP; let quat = Quaternion::euler_rotation(0.0, 0.0, 90.0); assert_eq!(quat * vector, Vector3::RIGHT);
Fields
x: f32
the X component
y: f32
the Y component
z: f32
the Z component
w: f32
the W component
Implementations
impl Quaternion
[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<Vector3>, angle: f32) -> Self
[src]
Create quaternion around axis
This rotates vectors around axis by the angle
pub fn look_rotation(
dir: impl Into<Vector3>,
global_up: impl Into<Vector3>
) -> Self
[src]
dir: impl Into<Vector3>,
global_up: impl Into<Vector3>
) -> Self
Create quaternion to rotate towards direction
Note: global_up
is used as a guide to try aligning to
pub fn inverse(self) -> Quaternion
[src]
Calculate the inverse rotation
Trait Implementations
impl Clone for Quaternion
[src]
pub fn clone(&self) -> Quaternion
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for Quaternion
[src]
impl Debug for Quaternion
[src]
impl Default for Quaternion
[src]
impl From<Matrix4> for Quaternion
[src]
impl From<Quaternion> for Matrix4
[src]
pub fn from(q: Quaternion) -> Self
[src]
impl Mul<Quaternion> for Quaternion
[src]
type Output = Self
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Self) -> Self
[src]
impl Mul<Vector3> for Quaternion
[src]
type Output = Vector3
The resulting type after applying the *
operator.
pub fn mul(self, rhs: Vector3) -> Vector3
[src]
impl MulAssign<Quaternion> for Quaternion
[src]
pub fn mul_assign(&mut self, rhs: Self)
[src]
impl PartialEq<Quaternion> for Quaternion
[src]
pub fn eq(&self, other: &Quaternion) -> bool
[src]
pub fn ne(&self, other: &Quaternion) -> bool
[src]
impl StructuralPartialEq for Quaternion
[src]
Auto Trait Implementations
impl RefUnwindSafe for Quaternion
impl Send for Quaternion
impl Sync for Quaternion
impl Unpin for Quaternion
impl UnwindSafe for Quaternion
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>,