From 4116ba40e5f8cc506eb59a1045a04885708742de Mon Sep 17 00:00:00 2001 From: Jarrod Doyle Date: Fri, 22 Sep 2023 15:57:28 +0100 Subject: [PATCH] Use iter to simplify brush plane intersection validation --- csg/src/brush.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/csg/src/brush.rs b/csg/src/brush.rs index a2a4d88..aa526fd 100644 --- a/csg/src/brush.rs +++ b/csg/src/brush.rs @@ -104,15 +104,8 @@ impl Brush { // TODO: No need to check against planes that are part of the intersection let mut raw_vertices = vec![]; for intersection in &intersections { - let mut valid = true; - for bplane in &self.planes { - if !intersection.in_halfspace_mat(&bplane.plane) { - valid = false; - break; - } - } - - if valid { + let mut iter = self.planes.iter(); + if iter.all(|bplane| intersection.in_halfspace_mat(&bplane.plane)) { raw_vertices.push(*intersection); } }