use approx::ApproxEq; use alga::general::{SubsetOf, Field}; use core::{Scalar, SquareMatrix}; use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use core::storage::OwnedStorage; use core::allocator::OwnedAllocator; use geometry::{TransformBase, TCategory, SuperTCategoryOf}; impl SubsetOf> for TransformBase where N1: Scalar + Field + ApproxEq + SubsetOf, N2: Scalar + Field + ApproxEq, C1: TCategory, C2: SuperTCategoryOf, D: DimNameAdd, SA: OwnedStorage, DimNameSum>, SB: OwnedStorage, DimNameSum>, SA::Alloc: OwnedAllocator, DimNameSum, SA>, SB::Alloc: OwnedAllocator, DimNameSum, SB>, N1::Epsilon: Copy, N2::Epsilon: Copy { #[inline] fn to_superset(&self) -> TransformBase { TransformBase::from_matrix_unchecked(self.to_homogeneous().to_superset()) } #[inline] fn is_in_subset(t: &TransformBase) -> bool { >::is_in_subset(t.matrix()) } #[inline] unsafe fn from_superset_unchecked(t: &TransformBase) -> Self { Self::from_superset_unchecked(t.matrix()) } } impl SubsetOf, SB>> for TransformBase where N1: Scalar + Field + ApproxEq + SubsetOf, N2: Scalar + Field + ApproxEq, C: TCategory, D: DimNameAdd, SA: OwnedStorage, DimNameSum>, SB: OwnedStorage, DimNameSum>, SA::Alloc: OwnedAllocator, DimNameSum, SA>, SB::Alloc: OwnedAllocator, DimNameSum, SB>, N1::Epsilon: Copy, N2::Epsilon: Copy { #[inline] fn to_superset(&self) -> SquareMatrix, SB> { self.matrix().to_superset() } #[inline] fn is_in_subset(m: &SquareMatrix, SB>) -> bool { C::check_homogeneous_invariants(m) } #[inline] unsafe fn from_superset_unchecked(m: &SquareMatrix, SB>) -> Self { TransformBase::from_matrix_unchecked(::convert_ref_unchecked(m)) } }