Godlike / Arion

Real-time oriented 3d collision detection library
MIT License
3 stars 1 forks source link

EPA endless loops #9

Open ilia-glushchenko opened 6 years ago

ilia-glushchenko commented 6 years ago

Create a scene with only two following bodies:

Position:
x   9.3000000000000007  
y   6.7000000000000002  
z   6   
Size vectors:
x   0.40000000596046448 
y   0.20000000298023224 
z   0.69999998807907104 
Sphere
Position:
x   8.9000000000000004  
y   6.9000000000000004  
z   6.7000000000000002  
Radius  1   

EPA will fall into the endless loop.

ilia-glushchenko commented 6 years ago

Workaround for this issue. https://github.com/Godlike/Pegasus/pull/94/commits/72c8c9b733f5ff94f61b5f4f72b7d0b94dafde01

ilia-glushchenko commented 6 years ago
pegasus::mechanics::Body box;
box.linearMotion.position = { 8.1999999999999993, 5.0000000000000000, 1.0000000000000000 };
glm::dvec3 iAxis{ 0.60000002384185791, 0.00000000000000000, 0.00000000000000000 };
glm::dvec3 jAxis{ 0.00000000000000000, 0.40000000596046448, 0.00000000000000000 };
glm::dvec3 kAxis{ 0.00000000000000000, 0.00000000000000000, 0.50000000000000000 };
g_objects.push_back(&demo.MakeBox(
    box, iAxis, jAxis, kAxis, pegasus::scene::Primitive::Type::DYNAMIC
));

pegasus::mechanics::Body sphere;
sphere.linearMotion.position = { 7.5999999999999996, 5.4000000000000004, 0.69999999999999996 };
g_objects.push_back(&demo.MakeSphere(
    sphere, 0.5, pegasus::scene::Primitive::Type::DYNAMIC
));

Will create an endless loop condition where the EPA would approach the round edge of the CSO but the time it takes it actually get to the termination is appears to grow exponentially.