I would like to report this bug on mesh.IsPointInside(). I found other posts mentioning something similar, but they are all quite old and related to rhino 7 (I’m using rhino 8).
To put it simple, mesh.IsPointInside() is returning false-positives; meaning that some points outside the mesh return True.
I believe it’s a bug because if I use brep.IsPointInside() instead, it works as intended.
I created this very simple script and rhino file attached to demonstrate this. If you run the script and select the mesh and points, there’s a row of points outside the mesh that remain intact. However, if you select a polysurface instead, the script finds all outside points correctly.
PS: the script I’m providing is just a simple example. My actual script requires mesh.IsPointInside() and it cannot be replaced by brep.IsPointInside().
you’re referring to this group of points that are exactly on the level of the edge, right?
If so, I see that this is fixed in RhinoBETA. Could you have a look if it behaves as you expect?
I don’t think it’s that - strictlyIn is True and so points that are at the surface get deleted (are considered outside). Either way, if it’s the first case, I’ll see if the fix for this issue can be backported to 8.
(untelated from thread, but… @martinsiegrist try to break it down to some component: if you do not try to figure out where things go amiss, we are without a report. Without a report, Rhino BETA will likely stay like this)
And for comparison, those points are indeed deleted if you pick the polysurface instead of the mesh when you ran the script (Rhino.Geometry.Brep.IsPointInside() method).
I’ve seen this behavior in multiple other meshes. It frequently misses just a few rows of points for some reason. These points are usually not on the mesh surface, so I don’t think that is the issue.
I’m currently using Rhino 8 and haven’t tried RhinoBETA yet, so it is possible this has been fixed in rhino 9. Although it looks like the issue is in the method itself, so if rhino 9 uses the same API then the problem will persist, I assume.
@Roberto_Neto going back to the very first post: could you please see if Rhino BETA works the way you need? If it does, I do not promise that I can backport the fix entirely, but certainly I can do something about these cases.
I downloaded Rhino BETA yesterday and it looks like it works as intended - meaning the InPointInside() function is not producing false-positives as far as I can tell.
The only thing that I noticed is that it is much slower than the rhino 8 version. When I ran it in bigger parts with more points, the difference is significant.
Thanks @Roberto_Neto for the test. I’ll see if I can help either cases. How much is speed important in your calculations? If it’s a matter of success vs failure, we can probably even give you two different functions (fast and simple vs slow and precise).
I use this function for volume discretization (discretize the volume into a pointcloud), which happens multiple times since the volume of the part changes slightly during the process I created. So I’d say speed is quite important to me.
I think having 2 functions is helpful. I could use the “slow and precise” one for the first discretization, and the “fast and simple” one for the pointcloud updates.