no revisit
This commit is contained in:
parent
f0fcf47ca9
commit
c4dba062eb
@ -70,18 +70,14 @@ fn planes_to_faces(face_list:std::collections::HashSet<Face>)->Result<Faces,Plan
|
||||
let mut intersection=solve3(face0,face1,face2).ok_or(PlanesToFacesError::InitIntersection)?;
|
||||
|
||||
// repeatedly update face0, face1 until all faces form part of the convex solid
|
||||
let mut clone_every_loop: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();
|
||||
'find: loop{
|
||||
// test if any *other* faces occlude the intersection
|
||||
for new_face in &face_list{
|
||||
if core::ptr::eq(face0,new_face){
|
||||
continue;
|
||||
}
|
||||
if core::ptr::eq(face1,new_face){
|
||||
continue;
|
||||
}
|
||||
if core::ptr::eq(face2,new_face){
|
||||
continue;
|
||||
}
|
||||
for &new_face in &clone_every_loop{
|
||||
// new face occludes intersection point
|
||||
if new_face.dot*intersection.den<new_face.normal.dot(intersection.num){
|
||||
// replace one of the faces with the new face
|
||||
@ -89,6 +85,7 @@ 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*new_intersection.den>face1.normal.dot(new_intersection.num){
|
||||
clone_every_loop.remove(new_face);
|
||||
face1=new_face;
|
||||
intersection=new_intersection;
|
||||
continue 'find;
|
||||
@ -97,6 +94,7 @@ 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*new_intersection.den>face2.normal.dot(new_intersection.num){
|
||||
clone_every_loop.remove(new_face);
|
||||
face2=new_face;
|
||||
intersection=new_intersection;
|
||||
continue 'find;
|
||||
|
Loading…
x
Reference in New Issue
Block a user