I ran some tests with the added Mesh.CreateConvexHull3D in RhinoCommon. Please see the attached GH file with internalized Point3d Lists for testing. List A gives a decent output whereas ListB returns an Invalid Mesh with lots of Mesh Faces. I have compared these against the QuickHull component.
My Rhino model is in Meters with a tolerance of 0.01. I also tested 0.001 and 0.0001 and so on. It seems that now when I test the same file I shared here, I don’t get Invalid Meshes anymore, but the ConvexHull C# script component is still really slow. I am running the latest 8.6 SRC. I was probably running 8.5 SR previously.
BUT, the plot thickens. I think I found where the problem originates from. So in essence, the same C# script component can take only 18ms or 1300ms with the same list of points. Please try to reproduce the problem with these steps:
Create a box in Rhino
Reference that box in Grasshopper and use Populate Geometry with 1000 or 2000 points on that referenced Box
Connect the populated points into the shared C# component → this will take a long time to calculate
Internalize the same point list and copy-paste it onto another GH Canvas
On that canvas, copy the same point container and paste it back into the original Canvas
Plug it in and see how the C# component only takes a fraction of the previous elapsed time
It seems that the Populate Geometry can create points with very high precision and that is the main cause of slowness. If you deconstruct the points and construct again into points but round the coordinates to something like 10 or 11 digits, it also results in a fast computation.
Good to hear you don’t get the invalid mesh anymore. Please be aware that it is a randomized incremental algorithm (https://ics.uci.edu/~eppstein/164/lecture8.pdf), so one can’t expect GH files to be reproducible. Per performance: that is also very important, but a different problem than “invalid mesh”. I hope I’ll be able to work more on the convex hull to improve its performance.
I understand. It’s just that both point lists should yield the same result in the same amount of time, now there’s a huge difference. At least I think they should since using the Set Difference the point lists seem equal.
Or do you mean that if I have two point containers in Grasshopper with identical points (at least nearly equal by their first 11 digits), they should not yield the same result due to the algorithm being based on a randomized approach?