1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
use std::mem;
use std::ops::{Deref, DerefMut};

use simba::simd::SimdValue;

use crate::base::coordinates::IJKW;
use crate::Scalar;

use crate::geometry::Quaternion;

impl<N: Scalar + SimdValue> Deref for Quaternion<N> {
    type Target = IJKW<N>;

    #[inline]
    fn deref(&self) -> &Self::Target {
        unsafe { mem::transmute(self) }
    }
}

impl<N: Scalar + SimdValue> DerefMut for Quaternion<N> {
    #[inline]
    fn deref_mut(&mut self) -> &mut Self::Target {
        unsafe { mem::transmute(self) }
    }
}