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 59 60
use alga::general::{SubsetOf, Real}; use core::{DefaultAllocator, MatrixN}; use core::dimension::{DimName, DimNameAdd, DimNameSum, U1}; use core::allocator::Allocator; use geometry::{Transform, TCategory, SuperTCategoryOf}; impl<N1, N2, D: DimName, C1, C2> SubsetOf<Transform<N2, D, C2>> for Transform<N1, D, C1> where N1: Real + SubsetOf<N2>, N2: Real, C1: TCategory, C2: SuperTCategoryOf<C1>, D: DimNameAdd<U1>, DefaultAllocator: Allocator<N1, DimNameSum<D, U1>, DimNameSum<D, U1>> + Allocator<N2, DimNameSum<D, U1>, DimNameSum<D, U1>>, N1::Epsilon: Copy, N2::Epsilon: Copy { #[inline] fn to_superset(&self) -> Transform<N2, D, C2> { Transform::from_matrix_unchecked(self.to_homogeneous().to_superset()) } #[inline] fn is_in_subset(t: &Transform<N2, D, C2>) -> bool { <Self as SubsetOf<_>>::is_in_subset(t.matrix()) } #[inline] unsafe fn from_superset_unchecked(t: &Transform<N2, D, C2>) -> Self { Self::from_superset_unchecked(t.matrix()) } } impl<N1, N2, D: DimName, C> SubsetOf<MatrixN<N2, DimNameSum<D, U1>>> for Transform<N1, D, C> where N1: Real + SubsetOf<N2>, N2: Real, C: TCategory, D: DimNameAdd<U1>, DefaultAllocator: Allocator<N1, DimNameSum<D, U1>, DimNameSum<D, U1>> + Allocator<N2, DimNameSum<D, U1>, DimNameSum<D, U1>>, N1::Epsilon: Copy, N2::Epsilon: Copy { #[inline] fn to_superset(&self) -> MatrixN<N2, DimNameSum<D, U1>> { self.matrix().to_superset() } #[inline] fn is_in_subset(m: &MatrixN<N2, DimNameSum<D, U1>>) -> bool { C::check_homogeneous_invariants(m) } #[inline] unsafe fn from_superset_unchecked(m: &MatrixN<N2, DimNameSum<D, U1>>) -> Self { Transform::from_matrix_unchecked(::convert_ref_unchecked(m)) } }