alloy::math

Struct DualQuaternion

source
#[repr(C)]
pub struct DualQuaternion { /* private fields */ }
Expand description

A dual-quaternion represents both translations and rotations in a combined format.

Implementations§

source§

impl DualQuaternion

source

pub const fn new(real: Quaternion, dual: Quaternion) -> Self

Creates a new dual quaternion from a real and dual quaternion.

§Parameters
  • real - The real part of the dual quaternion.
  • dual - The dual part of the dual quaternion.
source

pub const fn identity() -> Self

Constructs a new dual quaternion with the identity rotation and no translation.

source

pub const fn from_rotation(rotation: Quaternion) -> Self

Constructs this dual quaternion from a rotation quaternion.

§Parameters
  • rotation - The rotation quaternion to construct the dual quaternion from.
source

pub fn from_yaw<A: Angle>(angle: A) -> Self

Constructs this dual quaternion from the yaw angle

§Parameters
  • angle - The yaw angle.
source

pub fn from_pitch<A: Angle>(angle: A) -> Self

Constructs this dual quaternion from the pitch angle

§Parameters
  • angle - The pitch angle.
source

pub fn from_roll<A: Angle>(angle: A) -> Self

Constructs this dual quaternion from the roll angle

§Parameters
  • angle - The roll angle.
source

pub fn from_translation(translation: &Vec3) -> Self

Constructs this dual quaternion from a translation vector.

§Parameters
  • translation - The translation vector to construct the dual quaternion from.
source§

impl DualQuaternion

source

pub fn to_matrix4(&self) -> Matrix4

Returns the transform matrix representation of the quaternion.

source§

impl DualQuaternion

source

pub const fn real(&self) -> &Quaternion

Returns the real part of the dual quaternion.

source

pub const fn dual(&self) -> &Quaternion

Returns the dual part of the dual quaternion.

source

pub fn translation(&self) -> Vector3

Returns the translation component in local-space.

source

pub fn world_translation(&self) -> Vector3

Returns the translation of the dual quaternion in world-space.

source

pub const fn rotation(&self) -> &Quaternion

Returns the rotation component of the dual quaternion.

source

pub fn normalized(&self) -> DualQuaternion

Returns a normalized DualQuaternion.

source

pub fn conjugate(&self) -> DualQuaternion

Returns the conjugate of the dual quaternion.

source§

impl DualQuaternion

source

pub fn normalize(&mut self)

Normalizes the dual quaternion.

source

pub fn translate_world(&mut self, translation: &Vec3)

Translates the dual quaternion by the given vector in world space.

§Parameters
  • translation - The translation vector to apply to the dual quaternion.
source

pub fn translate(&mut self, translation: &Vec3)

Translates the dual quaternion by the given vector in local space.

This will translate relative to the orientation of the dual quaternion.

§Parameters
  • translation - The translation vector to apply to the dual quaternion.
source

pub fn rotate(&mut self, rotation: &Quaternion)

Rotates the dual quaternion by the given angle.

source

pub fn rotate_yaw<A: Angle>(&mut self, angle: A)

Rotates the dual quaternion by the given angle around the x-axis.

source

pub fn rotate_pitch<A: Angle>(&mut self, angle: A)

Rotates the dual quaternion by the given angle around the y-axis.

source

pub fn rotate_roll<A: Angle>(&mut self, angle: A)

Rotates the dual quaternion by the given angle around the z-axis.

Trait Implementations§

source§

impl Add for DualQuaternion

source§

type Output = DualQuaternion

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Self

Performs the + operation. Read more
source§

impl Clone for DualQuaternion

source§

fn clone(&self) -> DualQuaternion

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for DualQuaternion

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Mul for DualQuaternion

source§

type Output = DualQuaternion

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Self) -> Self

Performs the * operation. Read more
source§

impl PartialEq for DualQuaternion

source§

fn eq(&self, other: &DualQuaternion) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for DualQuaternion

source§

impl StructuralPartialEq for DualQuaternion

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.