refine naming

This commit is contained in:
2025-11-24 14:07:34 -08:00
parent 5ee8a02693
commit e11d96a9b3

View File

@@ -416,6 +416,18 @@ fn reduce_simplex(
}
}
// local function expand(
// queryP, queryQ,
// vertA0, vertA1,
// vertB0, vertB1,
// vertC0, vertC1,
// vertD0, vertD1,
// accuracy
// )
fn refine_to_exact(mesh:&MinkowskiMesh,simplex:Simplex)->Simplex{
unimplemented!()
}
/// Intermediate data structure containing a partially complete calculation.
/// Sometimes you only care about the topology, and not about the
/// exact point of intersection details.
@@ -423,7 +435,17 @@ pub struct Topology{
simplex:Simplex,
}
impl Topology{
pub fn details(self,mesh:&MinkowskiMesh)->Details{
/// Returns None if the point is intersecting the mesh.
pub fn closest_point_details(self,mesh:&MinkowskiMesh)->Option<Details>{
// NOTE: if hits is true, this if statement necessarily evaluates to true.
// i.e. hits implies this statement
// if -dist <= exitRadius + radiusP + radiusQ then
// local posP, posQ = decompose(-point, a0, a1, b0, b1, c0, c1)
// return hits, -dist - radiusP - radiusQ,
// posP - radiusP*norm, -norm,
// posQ + radiusQ*norm, norm
// end
// return false
unimplemented!()
}
}
@@ -438,7 +460,7 @@ pub struct Details{
pub fn contains_point(mesh:&MinkowskiMesh,point:Planar64Vec3)->bool{
const ENABLE_FAST_FAIL:bool=true;
minimum_difference::<ENABLE_FAST_FAIL,_>(mesh,point,
// expanded
// exact
|_simplex|{
// local norm = direction.unit
// local dist = a:Dot(norm)
@@ -446,7 +468,7 @@ pub fn contains_point(mesh:&MinkowskiMesh,point:Planar64Vec3)->bool{
// return hits
unimplemented!()
},
// unexpanded
// approximate
|_simplex|{
// intersection is guaranteed at this point
true
@@ -458,30 +480,13 @@ 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::<ENABLE_FAST_FAIL,_>(mesh,point,
// expanded
|_simplex|{
// NOTE: if hits is true, this if statement necessarily evaluates to true.
// i.e. hits implies this statement
// if -dist <= exitRadius + radiusP + radiusQ then
// local posP, posQ = decompose(-rel_pos, a0, a1, b0, b1, c0, c1)
// return hits, -dist - radiusP - radiusQ,
// posP - radiusP*norm, -norm,
// posQ + radiusQ*norm, norm
// end
// return false
unimplemented!()
},
// unexpanded
|_simplex|{
// exact
|simplex|Topology{simplex},
// approximate
|simplex|{
// local norm, dist, u0, u1, v0, v1, w0, w1 = expand(queryP, queryQ, a0, a1, b0, b1, c0, c1, d0, d1, 1e-5)
// if norm then
// local posP, posQ = decompose(-rel_pos, u0, u1, v0, v1, w0, w1)
// return true, -dist - radiusP - radiusQ,
// posP - radiusP*norm, -norm,
// posQ + radiusQ*norm, norm
// end
// return nil
unimplemented!()
let simplex=refine_to_exact(mesh,simplex);
Topology{simplex}
},
// fast_fail value is irrelevant and will never be returned!
Topology{simplex:Simplex::new_const()}
@@ -496,8 +501,8 @@ pub fn closest_fev(mesh:&MinkowskiMesh,point:Planar64Vec3)->Topology{
fn minimum_difference<const ENABLE_FAST_FAIL:bool,T>(
mesh:&MinkowskiMesh,
rel_pos:Planar64Vec3,
expanded:impl Fn(Simplex)->T,
unexpanded:impl Fn(Simplex)->T,
exact:impl Fn(Simplex)->T,
approximate:impl Fn(Simplex)->T,
fast_fail:T,
)->T{
// local initialAxis = queryQ() - queryP()
@@ -513,7 +518,7 @@ fn minimum_difference<const ENABLE_FAST_FAIL:bool,T>(
loop{
// if a and b and c and d then
if simplex.len()==SIMPLEX_TETRAHEDRON{
return unexpanded(simplex);
return approximate(simplex);
}
// new_point_p = queryP(-direction)
@@ -541,7 +546,7 @@ fn minimum_difference<const ENABLE_FAST_FAIL:bool,T>(
// 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 expanded(simplex);
return exact(simplex);
}
// direction, a0, a1, b0, b1, c0, c1, d0, d1 = reduceSimplex(new_point_p, new_point_q, a0, a1, b0, b1, c0, c1)