src/sets.rs

branch
dev
changeset 171
fa8df5a14486
parent 164
fd9dba51afd3
equal deleted inserted replaced
170:221728aeeb7e 171:fa8df5a14486
34 impl<U, const N: usize> Set<Loc<N, U>> for Cube<N, U> 34 impl<U, const N: usize> Set<Loc<N, U>> for Cube<N, U>
35 where 35 where
36 U: Num + PartialOrd + Sized, 36 U: Num + PartialOrd + Sized,
37 { 37 {
38 fn contains<I: Instance<Loc<N, U>>>(&self, item: I) -> bool { 38 fn contains<I: Instance<Loc<N, U>>>(&self, item: I) -> bool {
39 item.eval_ref_decompose(|r| self.0.iter().zip(r.iter()).all(|(s, x)| s.contains(x))) 39 item.eval_ref(|r| self.0.iter().zip(r.iter()).all(|(s, x)| s.contains(x)))
40 } 40 }
41 } 41 }
42 42
43 impl<U: Space> Set<U> for RangeFull { 43 impl<U: Space> Set<U> for RangeFull {
44 fn contains<I: Instance<U>>(&self, _item: I) -> bool { 44 fn contains<I: Instance<U>>(&self, _item: I) -> bool {
143 where 143 where
144 A: Euclidean<F>, 144 A: Euclidean<F>,
145 F: Float, 145 F: Float,
146 { 146 {
147 fn contains<I: Instance<A>>(&self, item: I) -> bool { 147 fn contains<I: Instance<A>>(&self, item: I) -> bool {
148 item.eval_ref_decompose(|r| self.0.iter().all(|halfspace| halfspace.contains(r))) 148 item.eval_ref(|r| self.0.iter().all(|halfspace| halfspace.contains(r)))
149 } 149 }
150 } 150 }

mercurial