From 4470e88d7b0493e79701916235e720dbba207a8a Mon Sep 17 00:00:00 2001 From: Rhys Lloyd Date: Mon, 24 Nov 2025 12:21:17 -0800 Subject: [PATCH] refactor calculation result --- engine/physics/src/minimum_difference.rs | 39 +++++++++++++++--------- 1 file changed, 24 insertions(+), 15 deletions(-) diff --git a/engine/physics/src/minimum_difference.rs b/engine/physics/src/minimum_difference.rs index fd3541f0..3a57336e 100644 --- a/engine/physics/src/minimum_difference.rs +++ b/engine/physics/src/minimum_difference.rs @@ -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{ + 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)->OptionOption