diff --git a/lib/bsp_loader/src/brush.rs b/lib/bsp_loader/src/brush.rs index 78706b2..4e8d11c 100644 --- a/lib/bsp_loader/src/brush.rs +++ b/lib/bsp_loader/src/brush.rs @@ -70,17 +70,10 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan let mut intersection=solve3(face0,face1,face2).ok_or(PlanesToFacesError::InitIntersection)?; - // drain a hashset of references to the original list - let mut remaining_face_refs:std::collections::HashSet<_>=face_list.iter().filter(|&new_face| - core::ptr::eq(face0,new_face) - |core::ptr::eq(face1,new_face) - |core::ptr::eq(face2,new_face) - ).collect(); - // repeatedly update face0, face1 until all faces form part of the convex solid 'find: loop{ // test if any *other* faces occlude the intersection - for &new_face in &remaining_face_refs{ + for new_face in &face_list{ // new face occludes intersection point if (new_face.dot.fix_2()/Planar64::ONE).lt_ratio(new_face.normal.dot(intersection.num)/intersection.den){ // replace one of the faces with the new face @@ -88,7 +81,6 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan if let Some(new_intersection)=solve3(face0,new_face,face2){ // face1 does not occlude (or intersect) the new intersection if (face1.dot.fix_2()/Planar64::ONE).gt_ratio(face1.normal.dot(new_intersection.num)/new_intersection.den){ - remaining_face_refs.remove(new_face); face1=new_face; intersection=new_intersection; continue 'find; @@ -97,7 +89,6 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan if let Some(new_intersection)=solve3(face0,face1,new_face){ // face2 does not occlude (or intersect) the new intersection if (face2.dot.fix_2()/Planar64::ONE).gt_ratio(face2.normal.dot(new_intersection.num)/new_intersection.den){ - remaining_face_refs.remove(new_face); face2=new_face; intersection=new_intersection; continue 'find;