use det to make numbers smaller

This commit is contained in:
Quaternions 2023-12-01 20:59:04 -08:00
parent 82b3201b0a
commit 9bfcf0b083
2 changed files with 13 additions and 2 deletions

View File

@ -807,6 +807,17 @@ impl std::ops::Mul<Time> for Planar64Vec3{
))
}
}
impl std::ops::Div<Planar64> for Planar64Vec3{
type Output=Planar64Vec3;
#[inline]
fn div(self,rhs:Planar64)->Self::Output{
Planar64Vec3(glam::i64vec3(
(((self.0.x as i128)<<32)/(rhs.0 as i128)) as i64,
(((self.0.y as i128)<<32)/(rhs.0 as i128)) as i64,
(((self.0.z as i128)<<32)/(rhs.0 as i128)) as i64,
))
}
}
impl std::ops::Div<i64> for Planar64Vec3{
type Output=Planar64Vec3;
#[inline]

View File

@ -272,8 +272,8 @@ impl MeshQuery<FaceId,DirectedEdgeId,VertId> for TransformedMesh<'_>{
fn face_nd(&self,face_id:FaceId)->(Planar64Vec3,Planar64){
let (n,d)=self.mesh.face_nd(face_id);
let transformed_n=*self.normal_transform*n;
let transformed_d=self.transform_det*d+transformed_n.dot(self.transform.translation);
(transformed_n,transformed_d)
let transformed_d=d+transformed_n.dot(self.transform.translation)/self.transform_det;
(transformed_n/self.transform_det,transformed_d)
}
fn vert(&self,vert_id:VertId)->Planar64Vec3{
self.transform.transform_point3(self.mesh.vert(vert_id))