From 941faf199d021e1e3c6b1094c6be4de5bda7c7cd Mon Sep 17 00:00:00 2001 From: Quaternions Date: Tue, 31 Oct 2023 19:32:37 -0700 Subject: [PATCH] vert and edge does not have an unambiguous face --- src/model_physics.rs | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/src/model_physics.rs b/src/model_physics.rs index 78576cb..543580d 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -23,14 +23,15 @@ struct Face{ struct Vert(Planar64Vec3); struct FaceRefs{ edges:Vec<(EdgeId,FaceId)>, - verts:Vec, + //verts:Vec, } struct EdgeRefs{ faces:[FaceId;2],//left, right - verts:[(VertId,FaceId);2],//bottom, top + verts:[VertId;2],//bottom, top } struct VertRefs{ - edges:Vec<(EdgeId,FaceId)>, + //faces:Vec, + edges:Vec, } pub struct PhysicsMesh{ faces:Vec, @@ -46,8 +47,8 @@ pub trait MeshQuery{ fn vert(&self,vert_id:VERT)->Planar64Vec3; fn face_edges(&self,face_id:FACE)->Cow>; fn edge_faces(&self,edge_id:EDGE)->Cow<[FACE;2]>; - fn edge_verts(&self,edge_id:EDGE)->Cow<[(VERT,FACE);2]>; - fn vert_edges(&self,vert_id:VERT)->Cow>; + fn edge_verts(&self,edge_id:EDGE)->Cow<[VERT;2]>; + fn vert_edges(&self,vert_id:VERT)->Cow>; } impl MeshQuery for PhysicsMesh{ fn closest_fev(&self,point:Planar64Vec3)->FEV{ @@ -107,21 +108,21 @@ impl MeshQuery for PhysicsMesh{ fn edge_faces(&self,edge_id:EdgeId)->Cow<[FaceId;2]>{ Cow::Borrowed(&self.edge_topology[edge_id.0].faces) } - fn edge_verts(&self,edge_id:EdgeId)->Cow<[(VertId,FaceId);2]>{ + fn edge_verts(&self,edge_id:EdgeId)->Cow<[VertId;2]>{ Cow::Borrowed(&self.edge_topology[edge_id.0].verts) } - fn vert_edges(&self,vert_id:VertId)->Cow>{ + fn vert_edges(&self,vert_id:VertId)->Cow>{ Cow::Borrowed(&self.vert_topology[vert_id.0].edges) } } -pub struct VirtualMesh<'a>{ +pub struct TransformedMesh<'a>{ mesh:&'a PhysicsMesh, transform:&'a crate::integer::Planar64Affine3, normal_transform:&'a crate::integer::Planar64Mat3, normal_determinant:Planar64, } -impl MeshQuery for VirtualMesh<'_>{ +impl MeshQuery for TransformedMesh<'_>{ fn closest_fev(&self,point:Planar64Vec3)->FEV{ //put some genius code right here todo!() @@ -142,11 +143,11 @@ impl MeshQuery for VirtualMesh<'_>{ self.mesh.edge_faces(edge_id) } #[inline] - fn edge_verts(&self,edge_id:EdgeId)->Cow<[(VertId,FaceId);2]>{ + fn edge_verts(&self,edge_id:EdgeId)->Cow<[VertId;2]>{ self.mesh.edge_verts(edge_id) } #[inline] - fn vert_edges(&self,vert_id:VertId)->Cow>{ + fn vert_edges(&self,vert_id:VertId)->Cow>{ self.mesh.vert_edges(vert_id) } } @@ -267,7 +268,7 @@ impl MeshQuery for MinkowskiMesh<'_>{ }, } } - fn edge_verts(&self,edge_id:MinkowskiEdge)->Cow<[(MinkowskiVert,MinkowskiFace);2]>{ + fn edge_verts(&self,edge_id:MinkowskiEdge)->Cow<[MinkowskiVert;2]>{ match edge_id{ MinkowskiEdge::VertEdge(v0,e1)=>{ Cow::Owned(self.mesh1.edge_verts(e1).map(|(vert_id1,face_id1)|{ @@ -281,7 +282,7 @@ impl MeshQuery for MinkowskiMesh<'_>{ }, } } - fn vert_edges(&self,vert_id:MinkowskiVert)->Cow>{ + fn vert_edges(&self,vert_id:MinkowskiVert)->Cow>{ match vert_id{ MinkowskiVert::VertVert(v0,v1)=>{ let v0e=self.mesh0.vert_edges(v0);