fix a near overflow bug

This commit is contained in:
Quaternions 2023-12-01 18:26:46 -08:00
parent 5c4bd4c3c7
commit 513414d4bd

View File

@ -451,9 +451,9 @@ impl MinkowskiMesh<'_>{
let face_n=self.face_nd(face_id).0;
//edge-face boundary nd, n facing out of the face towards the edge
let boundary_n=face_n.cross(edge_n)*(i as i64*2-1);
let boundary_d=boundary_n.dot(vert_sum);
let boundary_d=boundary_n.dot128(vert_sum);
// point.dot(boundary_n) is multiplied by two because vert_sum sums two vertices.
if infinity_dir.dot(boundary_n)==Planar64::ZERO&&point.dot(boundary_n)*2<=boundary_d{
if infinity_dir.dot(boundary_n)==Planar64::ZERO&&point.dot128(boundary_n)*2<=boundary_d{
//both faces cannot pass this condition, return early if one does.
return FEV::<MinkowskiFace,MinkowskiDirectedEdge,MinkowskiVert>::Face(face_id);
}