Test for point in a region defined by a surface

Hi there,
I am looking for a way to find points which are contained in a certain region defined by a planar surface (lying on the XY plane). The only workaround I’ve found is to lift the points above the XY plane and then project them onto the surface with the ProjectPoint component.
In the figure I sent, the points are the vertices of a mesh and the surface has the shape of letter ‘a’. In my final project I will have a collections of such letter-shaped surfaces and will have to select only vertices within the surfaces.

I have found this discussion: Points ‘In Region’ Instead of ‘In Curve’? but the region isn’t defined as a surface but as two boundary curves.

Thanks in advance.

don’t know of how many points/surfaces we are talking about, or the shape of the regions from a screenshot, better to post a sample file :slight_smile:

the first thing that comes to my mind is Pull Point (closest only) and https://developer.rhino3d.com/api/rhinocommon/rhino.collections.point3dlist/closestindexinlist
both to be applied to the Region center points, if the shape of the regions allow for that

There are many points (… which “are the vertices of a mesh”) and in the specific case I presented there is a single surface, but in the final project I will have a collection of surfaces.

I am attaching a sample file along with a screenshot of the definition.
The final goal is to modify the mesh by moving the selected vertices a certain way, so I have to add that in addition to selecting the vertices that are within the area, I need to know their indices as well in the vertices list, so that I can easily replace the original vertices by the moved ones and thus reconstruct the mesh.
I tried your suggestion, it has the advantage of being (about 3X) faster but it in addition to points which are in the original list of points it returns other points which aren’t (as one could expect). And as it find closest point to each point in the original list there a lot of duplicates. Thanks anyway.

The workaround I’ve found (projecting the vertices onto the surface) does well in retaining the indices of those points whose projections are within the surface, as you can see in the screenshot. I am wondering if there is another solution to that problem.

SelectPointsInRegion.gh (20.1 KB)

of course it does :slight_smile: it pulls each point to its closest geometry
but it gives you a D, Distance output that you can use to filter data
for instance the following, where you can filter stuff to get the indexes of the original mesh Vertexes that are on the surface of interest, or a list of Vertexes where Points that are not on the surface are Nulls

I mean, with the Distance table you can do whatever filtering you want on the initial Vertex List :slight_smile:

if you have multiple surfaces to check for proximity, then we can split in two cases:

  1. if you are not interested into knowing what point is on which surface, but you just want a True/False for each Mesh Vertex, then you are good to go as it is -and that is because the Pull Point method is set to Closest only-

  1. if you want to get a separate Full List of Mesh Vertexes for each shape, in such a way you can for instance apply different transformations depending on the shape, then Pull Point can go to to “all” and with a couple of Flip Matrix to get the same data structure as above

SelectPointsInRegion_Re_Re.gh (29.8 KB)

1 Like

MeshRay could be another option:

SelectPointsInRegion_v2.gh (30.6 KB)

1 Like

MUCH faster!!! :clap: :clap: :clap:

Thank you very much to you guys.

Many many thanks to @inno for your explanations which not only solved my initial problem but also solved the ultimate one (with a collection of surfaces).

Many thanks to @Adam_M as well for the wonderful solution which is indeed pretty fast.

I played with (and learnt from) both solutions and they work perfectly, unfortunately the site doesn’t let me select more than one answer as “Solution”. As @Adam_M one is faster and I have many surfaces, I would picked that one as the solution.

Thank you again!