bepu / bepuphysics2

Pure C# 3D real time physics simulation library, now with a higher version number.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

2.5.0-beta.20 - Convex hull error

sDIMMaX opened this issue · comments

Test - ConvexHullTestDemo
Unhandled exception. System.ArgumentException: Could not create a convex hull from the point set; is it degenerate? Convex hull shapes must have volume.

Edit:
I make simple new project and force target Net7.0(and BepuPhysics and BepuUtil in .csproj files) and ... it work. O_O
Net8.0 - error in runtime, Net7.0 - ok.

There are some pieces of test content in that demo which will trigger that error intentionally; a point set with no volume is invalid input. Did you see that error for a point set that unambiguously has volume?

I tested with simple manual cube.
points[0] = new System.Numerics.Vector3(0, 0, 0); points[1] = new System.Numerics.Vector3(0, 0, boxScale); ...
Error only if Net8.0.
somewhere in rawFaceVertexIndices in ComputeHull. in one case this 0 in other 2.

I'm not seeing a similar failure with CreateBoxConvexHull in ConvexHullTestDemo, could you give me a snippet of code that reproduces the problem within ConvexHullTestDemo?

PCS.zip
my dotnet version 8.0.201 and 7.0.406 (what you 8.0.xxx version?)
if in BepuPhysics.csproj and BepuUtilities.csproj i change to net7.0 - this works.

i think main problem in dotnet runtime. unsafe buffers/operations...

That's odd; running the repro with 8.0.201 appears to work for me. What CPU/OS are you using?

Reinstall. really odd, now i think this is CPU problem. something like dotnet/runtime#98704
i have 2 legacy pc(as remote "terminal") win10(1809 17763.3650) - cpu Intel celeron e3300 and old notebook win7(7601) intel p6100 and both have some issue. need test on main server pc when i reinstall hypervisor, dockers, os`s ...
in attachment 2 compiled versions
Debug.zip

edit: tested on net8.0.preview.1 - and it works... O_O ...
preview.2 and rc.1 - nope -_-

after hours of Console.WriteLine and debug.... i Found
previousEdgeDirection = Vector2.Normalize(facePoints[nextIndex] - facePoints[previousEndIndex]); in ReduceFace

code

			var v1 = new Vector2(0,2);
			var v2 = new Vector2(0,0);
			var previousEdgeDirection = Vector2.Normalize(v1 - v2);
			Console.WriteLine(previousEdgeDirection);

show <0 ∞> in net8.0 and <0 1> in 7.0.

OMG.
Close issue in this place and open in
dotnet/runtime#99391

Nice work! I know how fun narrowing that kind of thing down can be :P