| 1 |
use super::glam::{DMat2, DQuat, Mat2, Quat}; |
| 2 |
use crate::{Rotation2, Rotation3, UnitComplex, UnitQuaternion}; |
| 3 |
|
| 4 |
impl From<Rotation2<f32>> for Mat2 { |
| 5 |
#[inline] |
| 6 |
fn from(e: Rotation2<f32>) -> Mat2 { |
| 7 |
e.into_inner().into() |
| 8 |
} |
| 9 |
} |
| 10 |
|
| 11 |
impl From<Rotation2<f64>> for DMat2 { |
| 12 |
#[inline] |
| 13 |
fn from(e: Rotation2<f64>) -> DMat2 { |
| 14 |
e.into_inner().into() |
| 15 |
} |
| 16 |
} |
| 17 |
|
| 18 |
impl From<Rotation3<f32>> for Quat { |
| 19 |
#[inline] |
| 20 |
fn from(e: Rotation3<f32>) -> Quat { |
| 21 |
UnitQuaternion::from(e).into() |
| 22 |
} |
| 23 |
} |
| 24 |
|
| 25 |
impl From<Rotation3<f64>> for DQuat { |
| 26 |
#[inline] |
| 27 |
fn from(e: Rotation3<f64>) -> DQuat { |
| 28 |
UnitQuaternion::from(e).into() |
| 29 |
} |
| 30 |
} |
| 31 |
|
| 32 |
impl From<Mat2> for Rotation2<f32> { |
| 33 |
#[inline] |
| 34 |
fn from(e: Mat2) -> Rotation2<f32> { |
| 35 |
UnitComplex::from(e).to_rotation_matrix() |
| 36 |
} |
| 37 |
} |
| 38 |
|
| 39 |
impl From<DMat2> for Rotation2<f64> { |
| 40 |
#[inline] |
| 41 |
fn from(e: DMat2) -> Rotation2<f64> { |
| 42 |
UnitComplex::from(e).to_rotation_matrix() |
| 43 |
} |
| 44 |
} |
| 45 |
|
| 46 |
impl From<Quat> for Rotation3<f32> { |
| 47 |
#[inline] |
| 48 |
fn from(e: Quat) -> Rotation3<f32> { |
| 49 |
Rotation3::from(UnitQuaternion::from(e)) |
| 50 |
} |
| 51 |
} |
| 52 |
|
| 53 |
impl From<DQuat> for Rotation3<f64> { |
| 54 |
#[inline] |
| 55 |
fn from(e: DQuat) -> Rotation3<f64> { |
| 56 |
Rotation3::from(UnitQuaternion::from(e)) |
| 57 |
} |
| 58 |
} |