Struct nalgebra::geometry::DualQuaternion[][src]

#[repr(C)]
pub struct DualQuaternion<N: SimdRealField> { pub real: Quaternion<N>, pub dual: Quaternion<N>, }

A dual quaternion.

Indexing

DualQuaternions are stored as [..real, ..dual]. Both of the quaternion components are laid out in i, j, k, w order.


let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);

let dq = DualQuaternion::from_real_and_dual(real, dual);
assert_eq!(dq[0], 2.0);
assert_eq!(dq[1], 3.0);

assert_eq!(dq[4], 6.0);
assert_eq!(dq[7], 5.0);

NOTE: As of December 2020, dual quaternion support is a work in progress. If a feature that you need is missing, feel free to open an issue or a PR. See https://github.com/dimforge/nalgebra/issues/487

Fields

real: Quaternion<N>

The real component of the quaternion

dual: Quaternion<N>

The dual component of the quaternion

Implementations

impl<N: SimdRealField> DualQuaternion<N> where
    N::Element: SimdRealField
[src]

#[must_use = "Did you mean to use normalize_mut()?"]
pub fn normalize(&self) -> Self
[src]

Normalizes this quaternion.

Example

let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);
let dq = DualQuaternion::from_real_and_dual(real, dual);

let dq_normalized = dq.normalize();

relative_eq!(dq_normalized.real.norm(), 1.0);

pub fn normalize_mut(&mut self)[src]

Normalizes this quaternion.

Example

let real = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let dual = Quaternion::new(5.0, 6.0, 7.0, 8.0);
let mut dq = DualQuaternion::from_real_and_dual(real, dual);

dq.normalize_mut();

relative_eq!(dq.real.norm(), 1.0);

impl<N: SimdRealField> DualQuaternion<N>[src]

pub fn from_real_and_dual(real: Quaternion<N>, dual: Quaternion<N>) -> Self[src]

Creates a dual quaternion from its rotation and translation components.

Example

let rot = Quaternion::new(1.0, 2.0, 3.0, 4.0);
let trans = Quaternion::new(5.0, 6.0, 7.0, 8.0);

let dq = DualQuaternion::from_real_and_dual(rot, trans);
assert_eq!(dq.real.w, 1.0);

pub fn identity() -> Self[src]

The dual quaternion multiplicative identity

Example


let dq1 = DualQuaternion::identity();
let dq2 = DualQuaternion::from_real_and_dual(
    Quaternion::new(1.,2.,3.,4.),
    Quaternion::new(5.,6.,7.,8.)
);

assert_eq!(dq1 * dq2, dq2);
assert_eq!(dq2 * dq1, dq2);

Trait Implementations

impl<N: SimdRealField> Add<DualQuaternion<N>> for DualQuaternion<N> where
    N::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the + operator.

impl<N: SimdRealField> AsMut<[N; 8]> for DualQuaternion<N>[src]

impl<N: SimdRealField> AsRef<[N; 8]> for DualQuaternion<N>[src]

impl<N: Clone + SimdRealField> Clone for DualQuaternion<N>[src]

impl<N: Debug + SimdRealField> Debug for DualQuaternion<N>[src]

impl<N: Default + SimdRealField> Default for DualQuaternion<N>[src]

impl<'a, N: SimdRealField> Deserialize<'a> for DualQuaternion<N> where
    N: Deserialize<'a>, 
[src]

impl<N: SimdRealField> Index<usize> for DualQuaternion<N>[src]

type Output = N

The returned type after indexing.

impl<N: SimdRealField> IndexMut<usize> for DualQuaternion<N>[src]

impl<N: SimdRealField> Mul<DualQuaternion<N>> for DualQuaternion<N> where
    N::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the * operator.

impl<N: SimdRealField> Mul<N> for DualQuaternion<N> where
    N::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the * operator.

impl<N: PartialEq + SimdRealField> PartialEq<DualQuaternion<N>> for DualQuaternion<N>[src]

impl<N: SimdRealField> Serialize for DualQuaternion<N> where
    N: Serialize
[src]

impl<N: SimdRealField> Sub<DualQuaternion<N>> for DualQuaternion<N> where
    N::Element: SimdRealField
[src]

type Output = DualQuaternion<N>

The resulting type after applying the - operator.

impl<N: Copy + SimdRealField> Copy for DualQuaternion<N>[src]

impl<N: Eq + SimdRealField> Eq for DualQuaternion<N>[src]

impl<N: SimdRealField> StructuralEq for DualQuaternion<N>[src]

impl<N: SimdRealField> StructuralPartialEq for DualQuaternion<N>[src]

Auto Trait Implementations

impl<N> RefUnwindSafe for DualQuaternion<N> where
    N: RefUnwindSafe

impl<N> Send for DualQuaternion<N>

impl<N> Sync for DualQuaternion<N>

impl<N> Unpin for DualQuaternion<N> where
    N: Unpin

impl<N> UnwindSafe for DualQuaternion<N> where
    N: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T[src]

type Output = T

Should always be Self

impl<SS, SP> SupersetOf<SS> for SP where
    SS: SubsetOf<SP>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]