From e0581390bd84f81a46629250d8aeec66d764f003 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Mon, 6 Nov 2023 15:57:24 -0800 Subject: [PATCH] fix transformed face_nd --- src/model_physics.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/model_physics.rs b/src/model_physics.rs index 43e41e6..c6a756a 100644 --- a/src/model_physics.rs +++ b/src/model_physics.rs @@ -393,7 +393,10 @@ impl MeshQuery for TransformedMesh<'_>{ } fn face_nd(&self,face_id:FaceId)->(Planar64Vec3,Planar64){ let (n,d)=self.mesh.face_nd(face_id); - (*self.normal_transform*n,self.normal_determinant*d) + let transformed_n=*self.normal_transform*n; + let p=n*(d/n.dot(n)); + let transformed_d=transformed_n.dot(self.transform.transform_point3(p)); + (transformed_n,transformed_d) } fn vert(&self,vert_id:VertId)->Planar64Vec3{ self.transform.transform_point3(self.mesh.vert(vert_id))