2017-02-13 01:17:09 +08:00
|
|
|
use std::ops::{Deref, DerefMut};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2020-03-23 16:16:01 +08:00
|
|
|
use simba::simd::SimdValue;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
use crate::base::coordinates::IJKW;
|
2020-03-23 16:16:01 +08:00
|
|
|
use crate::Scalar;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
use crate::geometry::Quaternion;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + SimdValue> Deref for Quaternion<T> {
|
|
|
|
type Target = IJKW<T>;
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
#[inline]
|
|
|
|
fn deref(&self) -> &Self::Target {
|
2021-06-18 15:45:37 +08:00
|
|
|
unsafe { &*(self as *const Self as *const Self::Target) }
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + SimdValue> DerefMut for Quaternion<T> {
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
|
|
|
fn deref_mut(&mut self) -> &mut Self::Target {
|
2021-06-18 15:45:37 +08:00
|
|
|
unsafe { &mut *(self as *mut Self as *mut Self::Target) }
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
}
|