Any explanation for this strange Mesh Inclusion behaviour?

Im trying to create “spots” on a mesh. I generate spheres on the mesh, and test the mesh vertices for inclusion in those spheres, and then colour the mesh vertices accordingly. It mostly works, but I keep getting these weird lines - any idea whats going on?

mesh vertex inclusion issue.gh (1.3 MB)

don’t know exactly what’s going on there, but I would do it slightly differently :slight_smile:

because you are testing point inclusion inside a sphere, sphere which is a Center Point and a Radius, I would instead pull Point component on Mesh vertexes (closest) to those random Points, and check if the distance is smaller or equal to the radius of your sphere, which would mean the point is contained:

mesh vertex inclusion issue_inno.gh (1.3 MB)

the main difference is that, using this version, each time you want to test a new sphere radius you don’t need to recalculate point containment: because you already have a full list of calculated distances, the only calculation in play is the “smaller than” component, which is pretty fast to compute

Alternative faster approach could be meshspray

ah thanks! good idea