# Inside test in Geometry Nodes: Is a point located inside the convex hull? [duplicate]

It is easy to compute the convex hull in geometry nodes. It would be very helpful for me to find out, whether a random point is located inside the convex hull. My nodes setup is displayed in the image.Can this be easily achieved with geometry-nodes? The only possibility that comes to my mind, would be checking each point against every face.

The solution works for a lot of points but there are errors. I think, I know why.The point can be closer to a small face on the back of the convex hull, than to a large face on the front side. To be on the save side, this test would have to be done for every face of the convex hull.

• Ooops Thanks @Leander! (My comment on your answer was only to point out another way, not devalue this post, or your answers) I'll leave it to the other mods to decide on this one. Apr 4 at 8:51

For each point, do a ray cast in two opposite directions. If we get two hits, then the points must be inside the volume.

This node setup shoots rays in the $$(0, 0, -1)$$ and $$(0, 0, 1)$$ direction.

• Great! What a nice solution! Apr 3 at 16:42

For each point, sample the nearest surface position. Get the vector from the point to the sampled position. Compare that vector to the normal of the sampled position. If their dot product is greater than $$0$$, their angle will be $$< 90°$$ and the point will be inside the manifold convex hull.

For reasons I don't understand this answer apparently doesn't work. So I added an alternative.

• Unfortunately, this method only works partially. There are situations, when the nearest face is a backward face (relative to the location of the test point). Then the point is labeled to be inside wrongly. Apr 1 at 14:39
• I saw your edit and I can reproduce your issue, but I have no clue whats going on. So sorry. Should I delete this answer so that newcomers will try to add their answer? Apr 1 at 21:11
• I think, that the test has to be performed with every face. I asked a second post, how such a test could be performed: blender.stackexchange.com/questions/315797/… Therefore, don't worry about deleting this answer. It is appreciated by the community. Apr 2 at 7:19
• Apr 4 at 7:56

here look at this answer: https://blender.stackexchange.com/a/300089/165102

here is the part you want:

This is how to check for selections (if one mesh is inside another):