Add more conversion for Isometry

Add [T; D] -> Isometry<T, R, D>
Add SVector<T, D> -> Isometry<T, R, D>
Add Point<T, D> -> Isometry<T, R, D>
This commit is contained in:
Crozet Sébastien 2021-04-27 13:16:44 +02:00
parent 43cf22af28
commit 09be376cd9
1 changed files with 30 additions and 0 deletions

View File

@ -9,6 +9,7 @@ use crate::geometry::{
AbstractRotation, Isometry, Isometry3, Similarity, SuperTCategoryOf, TAffine, Transform, AbstractRotation, Isometry, Isometry3, Similarity, SuperTCategoryOf, TAffine, Transform,
Translation, UnitDualQuaternion, UnitQuaternion, Translation, UnitDualQuaternion, UnitQuaternion,
}; };
use crate::{Point, SVector};
/* /*
* This file provides the following conversions: * This file provides the following conversions:
@ -198,6 +199,35 @@ where
} }
} }
impl<T: SimdRealField, R, const D: usize> From<[T; D]> for Isometry<T, R, D>
where
R: AbstractRotation<T, D>,
{
#[inline]
fn from(coords: [T; D]) -> Self {
Self::from_parts(coords.into(), R::identity())
}
}
impl<T: SimdRealField, R, const D: usize> From<SVector<T, D>> for Isometry<T, R, D>
where
R: AbstractRotation<T, D>,
{
#[inline]
fn from(coords: SVector<T, D>) -> Self {
Self::from_parts(coords.into(), R::identity())
}
}
impl<T: SimdRealField, R, const D: usize> From<Point<T, D>> for Isometry<T, R, D>
where
R: AbstractRotation<T, D>,
{
#[inline]
fn from(coords: Point<T, D>) -> Self {
Self::from_parts(coords.into(), R::identity())
}
}
impl<T: Scalar + PrimitiveSimdValue, R, const D: usize> impl<T: Scalar + PrimitiveSimdValue, R, const D: usize>
From<[Isometry<T::Element, R::Element, D>; 2]> for Isometry<T, R, D> From<[Isometry<T::Element, R::Element, D>; 2]> for Isometry<T, R, D>
where where