From 2eadb541ccf655555df889eb1ed8dea929aa680c Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 20 Nov 2023 19:14:41 -0800 Subject: [PATCH] DirectedEdge.neg() --- src/model_physics.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/model_physics.rs b/src/model_physics.rs index 1a36f8a..7647672 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -19,6 +19,10 @@ pub trait DirectedEdge{ type UndirectedEdge:Copy+UndirectedEdge; fn as_undirected(&self)->Self::UndirectedEdge; fn parity(&self)->bool; + //this is stupid but may work fine + fn neg(&self)-><::UndirectedEdge as UndirectedEdge>::DirectedEdge{ + self.as_undirected().as_directed(!self.parity()) + } } /// DirectedEdgeId refers to an EdgeId when undirected. #[derive(Debug,Clone,Copy,Hash,Eq,PartialEq)] @@ -462,7 +466,7 @@ impl MeshQuery for MinkowskiM match face_id{ MinkowskiFace::VertFace(v0,f1)=>{ Cow::Owned(self.mesh1.face_edges(f1).iter().map(|&edge_id1|{ - MinkowskiDirectedEdge::VertEdge(v0,edge_id1) + MinkowskiDirectedEdge::VertEdge(v0,edge_id1.neg()) }).collect()) }, MinkowskiFace::EdgeEdge(e0,e1,parity)=>{