From b91ead7971477b2cffd24484d0345bb2fef7a303 Mon Sep 17 00:00:00 2001 From: Yuri Edward Date: Thu, 21 Oct 2021 15:56:07 +0200 Subject: [PATCH] Fixed Subset for Matrix --- src/geometry/scale_conversion.rs | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/src/geometry/scale_conversion.rs b/src/geometry/scale_conversion.rs index 1dbf3033..750a4b34 100644 --- a/src/geometry/scale_conversion.rs +++ b/src/geometry/scale_conversion.rs @@ -5,7 +5,7 @@ use simba::simd::PrimitiveSimdValue; use crate::base::allocator::Allocator; use crate::base::dimension::{DimNameAdd, DimNameSum, U1}; -use crate::base::{Const, DefaultAllocator, DimName, OMatrix, OVector, SVector, Scalar}; +use crate::base::{Const, DefaultAllocator, OMatrix, OVector, SVector, Scalar}; use crate::geometry::{Scale, SuperTCategoryOf, TAffine, Transform}; use crate::Point; @@ -77,8 +77,6 @@ where DefaultAllocator: Allocator, U1>, DimNameSum, U1>> + Allocator, U1>, U1> + Allocator, U1>, DimNameSum, U1>>, - // + Allocator - // + Allocator { #[inline] fn to_superset(&self) -> OMatrix, U1>, DimNameSum, U1>> { @@ -87,14 +85,17 @@ where #[inline] fn is_in_subset(m: &OMatrix, U1>, DimNameSum, U1>>) -> bool { - let id = m.generic_slice((0, 0), (DimNameSum::, U1>::name(), Const::)); - - // Scalar types agree. - m.iter().all(|e| SupersetOf::::is_in_subset(e)) && - // The block part does nothing. - id.is_identity(T2::zero()) && - // The normalization factor is one. - m[(D, D)] == T2::one() + if m[(D, D)] != T2::one() { + return false; + } + for i in 0..D + 1 { + for j in 0..D + 1 { + if i != j && m[(i, j)] != T2::zero() { + return false; + } + } + } + return true; } #[inline]