bepu / bepuphysics2

Pure C# 3D real time physics simulation library, now with a higher version number.
Apache License 2.0
2.25k stars 261 forks source link

bug: endless loop when create ConvexHull #266

Closed zyxia closed 10 months ago

zyxia commented 1 year ago

https://github.com/bepu/bepuphysics2/blob/ca78f54aa06d5352f8fb55db7552b9e7bf0ab075/BepuPhysics/Collidables/ConvexHullHelper.cs#L136 When x is close to 0 and y is greater than 0, the projectedPlaneNormalNarrow variable will become (-1, 0). This will cause the faceNormal calculated by function A in this line to be nearly equal to edgeToTest.FaceNormal. As a result, an edge will continuously be added to and removed from edgesToTest, leading to an infinite loop.

zyxia commented 1 year ago

points.zip the test data is in the zip file

RossNordby commented 1 year ago

Reproduced; thanks for the report! Probably will take a few days for me to get to this.

RossNordby commented 1 year ago

Alright, 21cc0d2a5f57884ceaaa7e33ca6a3ca9a4cbfe61 should fix it. Probably.