refactor calculation result
This commit is contained in:
@@ -416,21 +416,23 @@ fn reduce_simplex(
|
||||
}
|
||||
}
|
||||
|
||||
enum Expanded{
|
||||
Expanded,
|
||||
Unexpanded,
|
||||
}
|
||||
|
||||
/// Intermediate data structure containing a partially complete calculation.
|
||||
/// Sometimes you only care if the meshes are intersecting, and not about the
|
||||
/// exact point of intersection details.
|
||||
pub struct MinimumDifference{
|
||||
expanded:Expanded,
|
||||
pub enum MinimumDifference{
|
||||
Expanded{},
|
||||
Unexpanded{},
|
||||
}
|
||||
impl MinimumDifference{
|
||||
pub fn details(&self,mesh:&MinkowskiMesh,rel_pos:Planar64Vec3)->Details{
|
||||
match self.expanded{
|
||||
Expanded::Expanded=>{
|
||||
fn expanded()->Option<Self>{
|
||||
unimplemented!()
|
||||
}
|
||||
fn unexpanded()->Self{
|
||||
unimplemented!()
|
||||
}
|
||||
pub fn topology(self,mesh:&MinkowskiMesh,rel_pos:Planar64Vec3)->Topology{
|
||||
match self{
|
||||
Self::Expanded{}=>{
|
||||
// local norm = direction.unit
|
||||
// local dist = a:Dot(norm)
|
||||
// local hits = -dist < radiusP + radiusQ
|
||||
@@ -446,9 +448,9 @@ impl MinimumDifference{
|
||||
// posQ + radiusQ*norm, norm
|
||||
// end
|
||||
// return false
|
||||
Details{}
|
||||
Topology{}
|
||||
},
|
||||
Expanded::Unexpanded=>{
|
||||
Self::Unexpanded{}=>{
|
||||
// if testIntersection then
|
||||
// return true
|
||||
// end
|
||||
@@ -460,11 +462,18 @@ impl MinimumDifference{
|
||||
// posQ + radiusQ*norm, norm
|
||||
// end
|
||||
// return nil
|
||||
Details{}
|
||||
Topology{}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
pub struct Topology{
|
||||
}
|
||||
impl Topology{
|
||||
pub fn details(self)->Details{
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
pub struct Details{
|
||||
// distance:Planar64,
|
||||
// p_pos:Planar64Vec3,
|
||||
@@ -492,7 +501,7 @@ pub fn minimum_difference(mesh:&MinkowskiMesh,rel_pos:Planar64Vec3)->Option<Mini
|
||||
loop{
|
||||
// if a and b and c and d then
|
||||
if simplex.len()==SIMPLEX_TETRAHEDRON{
|
||||
// return Some(MinimumDifference::unexpanded());
|
||||
return Some(MinimumDifference::unexpanded());
|
||||
}
|
||||
|
||||
// new_point_p = queryP(-direction)
|
||||
@@ -520,7 +529,7 @@ pub fn minimum_difference(mesh:&MinkowskiMesh,rel_pos:Planar64Vec3)->Option<Mini
|
||||
// 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 Some(MinimumDifference::expanded());
|
||||
return MinimumDifference::expanded();
|
||||
}
|
||||
|
||||
// direction, a0, a1, b0, b1, c0, c1, d0, d1 = reduceSimplex(new_point_p, new_point_q, a0, a1, b0, b1, c0, c1)
|
||||
|
||||
Reference in New Issue
Block a user