From 0048306236eb562ced85982d9dfe01e7debec503 Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Mon, 24 Nov 2025 14:18:06 -0800 Subject: [PATCH] more naming things --- engine/physics/src/minimum_difference.rs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/engine/physics/src/minimum_difference.rs b/engine/physics/src/minimum_difference.rs index d59c37ae..0334b6c4 100644 --- a/engine/physics/src/minimum_difference.rs +++ b/engine/physics/src/minimum_difference.rs @@ -460,7 +460,7 @@ pub struct Details{ pub fn contains_point(mesh:&MinkowskiMesh,point:Planar64Vec3)->bool{ const ENABLE_FAST_FAIL:bool=true; minimum_difference::(mesh,point, - // exact + // on_exact |_simplex|{ // local norm = direction.unit // local dist = a:Dot(norm) @@ -468,7 +468,7 @@ pub fn contains_point(mesh:&MinkowskiMesh,point:Planar64Vec3)->bool{ // return hits unimplemented!() }, - // approximate + // on_intersecting |_simplex|{ // intersection is guaranteed at this point true @@ -480,9 +480,9 @@ pub fn contains_point(mesh:&MinkowskiMesh,point:Planar64Vec3)->bool{ pub fn closest_fev(mesh:&MinkowskiMesh,point:Planar64Vec3)->Topology{ const ENABLE_FAST_FAIL:bool=false; minimum_difference::(mesh,point, - // exact + // on_exact |simplex|Topology{simplex}, - // approximate + // on_intersecting |simplex|{ // local norm, dist, u0, u1, v0, v1, w0, w1 = expand(queryP, queryQ, a0, a1, b0, b1, c0, c1, d0, d1, 1e-5) let simplex=refine_to_exact(mesh,simplex); @@ -501,9 +501,9 @@ pub fn closest_fev(mesh:&MinkowskiMesh,point:Planar64Vec3)->Topology{ fn minimum_difference( mesh:&MinkowskiMesh, rel_pos:Planar64Vec3, - exact:impl Fn(Simplex)->T, - approximate:impl Fn(Simplex)->T, - fast_fail:T, + on_exact:impl Fn(Simplex)->T, + on_intersecting:impl Fn(Simplex)->T, + on_fast_fail:T, )->T{ // local initialAxis = queryQ() - queryP() // local new_point_p = queryP(initialAxis) @@ -518,7 +518,9 @@ fn minimum_difference( loop{ // if a and b and c and d then if simplex.len()==SIMPLEX_TETRAHEDRON{ - return approximate(simplex); + // Enough information to conclude that the meshes are intersecting. + // Topology information is computed if needed. + return on_intersecting(simplex); } // new_point_p = queryP(-direction) @@ -528,7 +530,7 @@ fn minimum_difference( // if -direction:Dot(next_point) > (exitRadius + radiusP + radiusQ)*direction.magnitude then if ENABLE_FAST_FAIL&&direction.dot(mesh.vert(next_point)+rel_pos).is_negative(){ - return fast_fail; + return on_fast_fail; } // push_front @@ -546,7 +548,8 @@ fn minimum_difference( // absDet(next_point, a, b, c) < 1e-6 if !direction.dot(mesh.vert(simplex[0])-mesh.vert(simplex[1])).is_positive() ||simplex_abs_det_is_zero(mesh,&simplex){ - return exact(simplex); + // Found enough information to compute the exact closest point. + return on_exact(simplex); } // direction, a0, a1, b0, b1, c0, c1, d0, d1 = reduceSimplex(new_point_p, new_point_q, a0, a1, b0, b1, c0, c1)