nalgebra/third_party/glam/common/
glam_rotation.rs

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::{DMat2, DQuat, Mat2, Quat};
use crate::{Rotation2, Rotation3, UnitComplex, UnitQuaternion};

impl From<Rotation2<f32>> for Mat2 {
    #[inline]
    fn from(e: Rotation2<f32>) -> Mat2 {
        e.into_inner().into()
    }
}

impl From<Rotation2<f64>> for DMat2 {
    #[inline]
    fn from(e: Rotation2<f64>) -> DMat2 {
        e.into_inner().into()
    }
}

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

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

impl From<Mat2> for Rotation2<f32> {
    #[inline]
    fn from(e: Mat2) -> Rotation2<f32> {
        UnitComplex::from(e).to_rotation_matrix()
    }
}

impl From<DMat2> for Rotation2<f64> {
    #[inline]
    fn from(e: DMat2) -> Rotation2<f64> {
        UnitComplex::from(e).to_rotation_matrix()
    }
}

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

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