2016-12-05 05:44:42 +08:00
|
|
|
use std::mem;
|
2017-02-13 01:17:09 +08:00
|
|
|
use std::ops::{Deref, DerefMut};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
use alga::general::Real;
|
|
|
|
|
|
|
|
use core::coordinates::IJKW;
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
use geometry::Quaternion;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
impl<N: Real> Deref for Quaternion<N> {
|
2016-12-05 05:44:42 +08:00
|
|
|
type Target = IJKW<N>;
|
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn deref(&self) -> &Self::Target {
|
|
|
|
unsafe { mem::transmute(self) }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-08-03 01:37:44 +08:00
|
|
|
impl<N: Real> DerefMut for Quaternion<N> {
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
|
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
|
|
|
unsafe { mem::transmute(self) }
|
|
|
|
}
|
|
|
|
}
|