From f4db20c206cfba65105300605d82d37fec39acf9 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 20 Nov 2023 18:49:36 -0800 Subject: [PATCH] swap edge faces in VertEdge case --- src/model_physics.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/src/model_physics.rs b/src/model_physics.rs index b387264..f11f634 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -472,11 +472,9 @@ impl MeshQuery for MinkowskiM fn edge_faces(&self,edge_id:MinkowskiEdge)->Cow<[MinkowskiFace;2]>{ match edge_id{ MinkowskiEdge::VertEdge(v0,e1)=>{ - //tracking index with an external variable because .enumerate() is not available - let mut i=0; - Cow::Owned(self.mesh1.edge_faces(e1).map(|edge_face_id1|{ - let face_parity=i==0; - i+=1; + //faces are listed backwards from the minkowski mesh + let e1f=self.mesh1.edge_faces(e1); + Cow::Owned([(e1f[1],true),(e1f[0],false)].map(|(edge_face_id1,face_parity)|{ let mut best_edge=None; let mut best_d=Planar64::ZERO; let edge_face1_n=self.mesh1.face_nd(edge_face_id1).0; @@ -495,6 +493,7 @@ impl MeshQuery for MinkowskiM })) }, MinkowskiEdge::EdgeVert(e0,v1)=>{ + //tracking index with an external variable because .enumerate() is not available let mut i=0; Cow::Owned(self.mesh0.edge_faces(e0).map(|edge_face_id0|{ let face_parity=i==0;