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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
use super::glam::{DQuat, Quat};
use crate::{Quaternion, UnitQuaternion};

impl From<Quat> for Quaternion<f32> {
    #[inline]
    fn from(e: Quat) -> Quaternion<f32> {
        Quaternion::new(e.w, e.x, e.y, e.z)
    }
}

impl From<Quaternion<f32>> for Quat {
    #[inline]
    fn from(e: Quaternion<f32>) -> Quat {
        Quat::from_xyzw(e.i, e.j, e.k, e.w)
    }
}

impl From<UnitQuaternion<f32>> for Quat {
    #[inline]
    fn from(e: UnitQuaternion<f32>) -> Quat {
        Quat::from_xyzw(e.i, e.j, e.k, e.w)
    }
}

impl From<DQuat> for Quaternion<f64> {
    #[inline]
    fn from(e: DQuat) -> Quaternion<f64> {
        Quaternion::new(e.w, e.x, e.y, e.z)
    }
}

impl From<Quaternion<f64>> for DQuat {
    #[inline]
    fn from(e: Quaternion<f64>) -> DQuat {
        DQuat::from_xyzw(e.i, e.j, e.k, e.w)
    }
}

impl From<UnitQuaternion<f64>> for DQuat {
    #[inline]
    fn from(e: UnitQuaternion<f64>) -> DQuat {
        DQuat::from_xyzw(e.i, e.j, e.k, e.w)
    }
}

impl From<Quat> for UnitQuaternion<f32> {
    #[inline]
    fn from(e: Quat) -> UnitQuaternion<f32> {
        UnitQuaternion::new_normalize(Quaternion::from(e))
    }
}

impl From<DQuat> for UnitQuaternion<f64> {
    #[inline]
    fn from(e: DQuat) -> UnitQuaternion<f64> {
        UnitQuaternion::new_normalize(Quaternion::from(e))
    }
}