2020-03-21 19:16:46 +08:00
|
|
|
use simba::scalar::{RealField, SubsetOf, SupersetOf};
|
2020-03-23 16:16:01 +08:00
|
|
|
use simba::simd::{PrimitiveSimdValue, SimdRealField, SimdValue};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
use crate::base::allocator::Allocator;
|
2021-04-07 20:29:20 +08:00
|
|
|
use crate::base::dimension::{DimMin, DimNameAdd, DimNameSum, U1};
|
2021-04-11 17:00:38 +08:00
|
|
|
use crate::base::{Const, DefaultAllocator, OMatrix, Scalar};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2020-03-21 19:16:46 +08:00
|
|
|
use crate::geometry::{
|
2021-01-29 06:25:32 +08:00
|
|
|
AbstractRotation, Isometry, Isometry3, Similarity, SuperTCategoryOf, TAffine, Transform,
|
2021-01-29 07:46:14 +08:00
|
|
|
Translation, UnitDualQuaternion, UnitQuaternion,
|
2020-03-21 19:16:46 +08:00
|
|
|
};
|
2021-04-27 19:16:44 +08:00
|
|
|
use crate::{Point, SVector};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* This file provides the following conversions:
|
|
|
|
* =============================================
|
|
|
|
*
|
2017-08-03 01:37:44 +08:00
|
|
|
* Isometry -> Isometry
|
2021-01-29 06:25:32 +08:00
|
|
|
* Isometry3 -> UnitDualQuaternion
|
2017-08-03 01:37:44 +08:00
|
|
|
* Isometry -> Similarity
|
|
|
|
* Isometry -> Transform
|
|
|
|
* Isometry -> Matrix (homogeneous)
|
2016-12-05 05:44:42 +08:00
|
|
|
*/
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T1, T2, R1, R2, const D: usize> SubsetOf<Isometry<T2, R2, D>> for Isometry<T1, R1, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T1: RealField,
|
|
|
|
T2: RealField + SupersetOf<T1>,
|
|
|
|
R1: AbstractRotation<T1, D> + SubsetOf<R2>,
|
|
|
|
R2: AbstractRotation<T2, D>,
|
2018-02-02 19:26:35 +08:00
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn to_superset(&self) -> Isometry<T2, R2, D> {
|
2018-02-02 19:26:35 +08:00
|
|
|
Isometry::from_parts(self.translation.to_superset(), self.rotation.to_superset())
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn is_in_subset(iso: &Isometry<T2, R2, D>) -> bool {
|
|
|
|
crate::is_convertible::<_, Translation<T1, D>>(&iso.translation)
|
2019-03-23 21:29:07 +08:00
|
|
|
&& crate::is_convertible::<_, R1>(&iso.rotation)
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from_superset_unchecked(iso: &Isometry<T2, R2, D>) -> Self {
|
2017-08-03 01:37:44 +08:00
|
|
|
Isometry::from_parts(
|
2016-12-05 05:44:42 +08:00
|
|
|
iso.translation.to_subset_unchecked(),
|
2018-02-02 19:26:35 +08:00
|
|
|
iso.rotation.to_subset_unchecked(),
|
2016-12-05 05:44:42 +08:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T1, T2> SubsetOf<UnitDualQuaternion<T2>> for Isometry3<T1>
|
2021-01-29 06:25:32 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T1: RealField,
|
|
|
|
T2: RealField + SupersetOf<T1>,
|
2021-01-29 06:25:32 +08:00
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn to_superset(&self) -> UnitDualQuaternion<T2> {
|
|
|
|
let dq = UnitDualQuaternion::<T1>::from_isometry(self);
|
2021-01-29 06:25:32 +08:00
|
|
|
dq.to_superset()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn is_in_subset(dq: &UnitDualQuaternion<T2>) -> bool {
|
|
|
|
crate::is_convertible::<_, UnitQuaternion<T1>>(&dq.rotation())
|
|
|
|
&& crate::is_convertible::<_, Translation<T1, 3>>(&dq.translation())
|
2021-01-29 06:25:32 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from_superset_unchecked(dq: &UnitDualQuaternion<T2>) -> Self {
|
|
|
|
let dq: UnitDualQuaternion<T1> = crate::convert_ref_unchecked(dq);
|
2021-01-29 06:25:32 +08:00
|
|
|
dq.to_isometry()
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T1, T2, R1, R2, const D: usize> SubsetOf<Similarity<T2, R2, D>> for Isometry<T1, R1, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T1: RealField,
|
|
|
|
T2: RealField + SupersetOf<T1>,
|
|
|
|
R1: AbstractRotation<T1, D> + SubsetOf<R2>,
|
|
|
|
R2: AbstractRotation<T2, D>,
|
2018-02-02 19:26:35 +08:00
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn to_superset(&self) -> Similarity<T2, R2, D> {
|
|
|
|
Similarity::from_isometry(self.to_superset(), T2::one())
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn is_in_subset(sim: &Similarity<T2, R2, D>) -> bool {
|
|
|
|
crate::is_convertible::<_, Isometry<T1, R1, D>>(&sim.isometry) && sim.scaling() == T2::one()
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from_superset_unchecked(sim: &Similarity<T2, R2, D>) -> Self {
|
2019-03-23 21:29:07 +08:00
|
|
|
crate::convert_ref_unchecked(&sim.isometry)
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T1, T2, R, C, const D: usize> SubsetOf<Transform<T2, C, D>> for Isometry<T1, R, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T1: RealField,
|
|
|
|
T2: RealField + SupersetOf<T1>,
|
2018-02-02 19:26:35 +08:00
|
|
|
C: SuperTCategoryOf<TAffine>,
|
2021-04-11 17:00:38 +08:00
|
|
|
R: AbstractRotation<T1, D>
|
|
|
|
+ SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>
|
|
|
|
+ SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
|
2021-04-07 20:29:20 +08:00
|
|
|
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>, // needed by .is_special_orthogonal()
|
2021-04-11 17:00:38 +08:00
|
|
|
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
|
|
|
|
+ Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
|
|
|
|
+ Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
|
|
|
|
// + Allocator<T1, D>
|
2021-04-07 20:29:20 +08:00
|
|
|
// + Allocator<(usize, usize), D>
|
2021-04-11 17:00:38 +08:00
|
|
|
// + Allocator<T2, D, D>
|
|
|
|
// + Allocator<T2, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn to_superset(&self) -> Transform<T2, C, D> {
|
2017-08-03 01:37:44 +08:00
|
|
|
Transform::from_matrix_unchecked(self.to_homogeneous().to_superset())
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn is_in_subset(t: &Transform<T2, C, D>) -> bool {
|
2016-12-05 05:44:42 +08:00
|
|
|
<Self as SubsetOf<_>>::is_in_subset(t.matrix())
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from_superset_unchecked(t: &Transform<T2, C, D>) -> Self {
|
2016-12-05 05:44:42 +08:00
|
|
|
Self::from_superset_unchecked(t.matrix())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T1, T2, R, const D: usize>
|
|
|
|
SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>> for Isometry<T1, R, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T1: RealField,
|
|
|
|
T2: RealField + SupersetOf<T1>,
|
|
|
|
R: AbstractRotation<T1, D>
|
|
|
|
+ SubsetOf<OMatrix<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>
|
|
|
|
+ SubsetOf<OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
|
2021-04-07 20:29:20 +08:00
|
|
|
Const<D>: DimNameAdd<U1> + DimMin<Const<D>, Output = Const<D>>, // needed by .is_special_orthogonal()
|
2021-04-11 17:00:38 +08:00
|
|
|
DefaultAllocator: Allocator<T1, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
|
|
|
|
+ Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
|
|
|
|
+ Allocator<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>, // + Allocator<(usize, usize), D>
|
|
|
|
// + Allocator<T2, D, D>
|
|
|
|
// + Allocator<T2, D>
|
|
|
|
// + Allocator<T1, D>
|
|
|
|
// + Allocator<T1, D, D>
|
2018-02-02 19:26:35 +08:00
|
|
|
{
|
2016-12-05 05:44:42 +08:00
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn to_superset(&self) -> OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>> {
|
2016-12-05 05:44:42 +08:00
|
|
|
self.to_homogeneous().to_superset()
|
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn is_in_subset(m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>) -> bool {
|
|
|
|
let rot = m.fixed_slice::<D, D>(0, 0);
|
|
|
|
let bottom = m.fixed_slice::<1, D>(D, 0);
|
2016-12-05 05:44:42 +08:00
|
|
|
|
|
|
|
// Scalar types agree.
|
2021-04-11 17:00:38 +08:00
|
|
|
m.iter().all(|e| SupersetOf::<T1>::is_in_subset(e)) &&
|
2016-12-05 05:44:42 +08:00
|
|
|
// The block part is a rotation.
|
2021-04-11 17:00:38 +08:00
|
|
|
rot.is_special_orthogonal(T2::default_epsilon() * crate::convert(100.0)) &&
|
2016-12-05 05:44:42 +08:00
|
|
|
// The bottom row is (0, 0, ..., 1)
|
2021-04-11 17:00:38 +08:00
|
|
|
bottom.iter().all(|e| e.is_zero()) && m[(D, D)] == T2::one()
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from_superset_unchecked(
|
|
|
|
m: &OMatrix<T2, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>,
|
|
|
|
) -> Self {
|
|
|
|
let t = m.fixed_slice::<D, 1>(0, D).into_owned();
|
2018-10-28 14:33:39 +08:00
|
|
|
let t = Translation {
|
2019-03-23 21:29:07 +08:00
|
|
|
vector: crate::convert_unchecked(t),
|
2018-10-28 14:33:39 +08:00
|
|
|
};
|
2016-12-05 05:44:42 +08:00
|
|
|
|
2019-03-23 21:29:07 +08:00
|
|
|
Self::from_parts(t, crate::convert_unchecked(m.clone_owned()))
|
2016-12-05 05:44:42 +08:00
|
|
|
}
|
|
|
|
}
|
2018-10-13 16:25:34 +08:00
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: SimdRealField, R: AbstractRotation<T, D>, const D: usize> From<Translation<T, D>>
|
|
|
|
for Isometry<T, R, D>
|
2020-10-25 18:24:20 +08:00
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(tra: Translation<T, D>) -> Self {
|
2020-10-25 18:24:20 +08:00
|
|
|
Self::from_parts(tra, R::identity())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: SimdRealField, R, const D: usize> From<Isometry<T, R, D>>
|
|
|
|
for OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>
|
2018-10-13 16:25:34 +08:00
|
|
|
where
|
2021-04-07 20:29:20 +08:00
|
|
|
Const<D>: DimNameAdd<U1>,
|
2021-04-11 17:00:38 +08:00
|
|
|
R: SubsetOf<OMatrix<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>>,
|
|
|
|
DefaultAllocator: Allocator<T, DimNameSum<Const<D>, U1>, DimNameSum<Const<D>, U1>>, // + Allocator<T, D>,
|
2018-10-13 16:25:34 +08:00
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(iso: Isometry<T, R, D>) -> Self {
|
2018-10-13 16:25:34 +08:00
|
|
|
iso.to_homogeneous()
|
|
|
|
}
|
|
|
|
}
|
2020-03-23 16:16:01 +08:00
|
|
|
|
2021-04-27 19:16:44 +08:00
|
|
|
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())
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + PrimitiveSimdValue, R, const D: usize>
|
|
|
|
From<[Isometry<T::Element, R::Element, D>; 2]> for Isometry<T, R, D>
|
2020-03-24 17:16:31 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T: From<[<T as SimdValue>::Element; 2]>,
|
|
|
|
R: SimdValue + AbstractRotation<T, D> + From<[<R as SimdValue>::Element; 2]>,
|
|
|
|
R::Element: AbstractRotation<T::Element, D>,
|
|
|
|
T::Element: Scalar + Copy,
|
2020-03-24 17:16:31 +08:00
|
|
|
R::Element: Scalar + Copy,
|
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(arr: [Isometry<T::Element, R::Element, D>; 2]) -> Self {
|
2021-06-18 15:45:37 +08:00
|
|
|
let tra = Translation::from([arr[0].translation, arr[1].translation]);
|
2020-11-19 19:55:15 +08:00
|
|
|
let rot = R::from([arr[0].rotation, arr[0].rotation]);
|
2020-03-24 17:16:31 +08:00
|
|
|
|
|
|
|
Self::from_parts(tra, rot)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + PrimitiveSimdValue, R, const D: usize>
|
|
|
|
From<[Isometry<T::Element, R::Element, D>; 4]> for Isometry<T, R, D>
|
2020-03-24 17:16:31 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T: From<[<T as SimdValue>::Element; 4]>,
|
|
|
|
R: SimdValue + AbstractRotation<T, D> + From<[<R as SimdValue>::Element; 4]>,
|
|
|
|
R::Element: AbstractRotation<T::Element, D>,
|
|
|
|
T::Element: Scalar + Copy,
|
2020-03-24 17:16:31 +08:00
|
|
|
R::Element: Scalar + Copy,
|
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(arr: [Isometry<T::Element, R::Element, D>; 4]) -> Self {
|
2020-03-24 17:16:31 +08:00
|
|
|
let tra = Translation::from([
|
2021-06-18 15:45:37 +08:00
|
|
|
arr[0].translation,
|
|
|
|
arr[1].translation,
|
|
|
|
arr[2].translation,
|
|
|
|
arr[3].translation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
let rot = R::from([
|
2020-11-19 19:55:15 +08:00
|
|
|
arr[0].rotation,
|
|
|
|
arr[1].rotation,
|
|
|
|
arr[2].rotation,
|
|
|
|
arr[3].rotation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
Self::from_parts(tra, rot)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + PrimitiveSimdValue, R, const D: usize>
|
|
|
|
From<[Isometry<T::Element, R::Element, D>; 8]> for Isometry<T, R, D>
|
2020-03-24 17:16:31 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T: From<[<T as SimdValue>::Element; 8]>,
|
|
|
|
R: SimdValue + AbstractRotation<T, D> + From<[<R as SimdValue>::Element; 8]>,
|
|
|
|
R::Element: AbstractRotation<T::Element, D>,
|
|
|
|
T::Element: Scalar + Copy,
|
2020-03-24 17:16:31 +08:00
|
|
|
R::Element: Scalar + Copy,
|
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(arr: [Isometry<T::Element, R::Element, D>; 8]) -> Self {
|
2020-03-24 17:16:31 +08:00
|
|
|
let tra = Translation::from([
|
2021-06-18 15:45:37 +08:00
|
|
|
arr[0].translation,
|
|
|
|
arr[1].translation,
|
|
|
|
arr[2].translation,
|
|
|
|
arr[3].translation,
|
|
|
|
arr[4].translation,
|
|
|
|
arr[5].translation,
|
|
|
|
arr[6].translation,
|
|
|
|
arr[7].translation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
let rot = R::from([
|
2020-11-19 19:55:15 +08:00
|
|
|
arr[0].rotation,
|
|
|
|
arr[1].rotation,
|
|
|
|
arr[2].rotation,
|
|
|
|
arr[3].rotation,
|
|
|
|
arr[4].rotation,
|
|
|
|
arr[5].rotation,
|
|
|
|
arr[6].rotation,
|
|
|
|
arr[7].rotation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
Self::from_parts(tra, rot)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-04-11 17:00:38 +08:00
|
|
|
impl<T: Scalar + PrimitiveSimdValue, R, const D: usize>
|
|
|
|
From<[Isometry<T::Element, R::Element, D>; 16]> for Isometry<T, R, D>
|
2020-03-24 17:16:31 +08:00
|
|
|
where
|
2021-04-11 17:00:38 +08:00
|
|
|
T: From<[<T as SimdValue>::Element; 16]>,
|
|
|
|
R: SimdValue + AbstractRotation<T, D> + From<[<R as SimdValue>::Element; 16]>,
|
|
|
|
R::Element: AbstractRotation<T::Element, D>,
|
|
|
|
T::Element: Scalar + Copy,
|
2020-03-24 17:16:31 +08:00
|
|
|
R::Element: Scalar + Copy,
|
|
|
|
{
|
|
|
|
#[inline]
|
2021-04-11 17:00:38 +08:00
|
|
|
fn from(arr: [Isometry<T::Element, R::Element, D>; 16]) -> Self {
|
2020-03-24 17:16:31 +08:00
|
|
|
let tra = Translation::from([
|
2021-06-18 15:45:37 +08:00
|
|
|
arr[0].translation,
|
|
|
|
arr[1].translation,
|
|
|
|
arr[2].translation,
|
|
|
|
arr[3].translation,
|
|
|
|
arr[4].translation,
|
|
|
|
arr[5].translation,
|
|
|
|
arr[6].translation,
|
|
|
|
arr[7].translation,
|
|
|
|
arr[8].translation,
|
|
|
|
arr[9].translation,
|
|
|
|
arr[10].translation,
|
|
|
|
arr[11].translation,
|
|
|
|
arr[12].translation,
|
|
|
|
arr[13].translation,
|
|
|
|
arr[14].translation,
|
|
|
|
arr[15].translation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
let rot = R::from([
|
2020-11-19 19:55:15 +08:00
|
|
|
arr[0].rotation,
|
|
|
|
arr[1].rotation,
|
|
|
|
arr[2].rotation,
|
|
|
|
arr[3].rotation,
|
|
|
|
arr[4].rotation,
|
|
|
|
arr[5].rotation,
|
|
|
|
arr[6].rotation,
|
|
|
|
arr[7].rotation,
|
|
|
|
arr[8].rotation,
|
|
|
|
arr[9].rotation,
|
|
|
|
arr[10].rotation,
|
|
|
|
arr[11].rotation,
|
|
|
|
arr[12].rotation,
|
|
|
|
arr[13].rotation,
|
|
|
|
arr[14].rotation,
|
|
|
|
arr[15].rotation,
|
2020-03-24 17:16:31 +08:00
|
|
|
]);
|
|
|
|
|
|
|
|
Self::from_parts(tra, rot)
|
|
|
|
}
|
|
|
|
}
|