6
$\begingroup$

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.

enter image description here

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.

enter image description here

$\endgroup$
1
  • $\begingroup$ 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. $\endgroup$
    – Robin Betts
    Apr 4 at 8:51

3 Answers 3

1
$\begingroup$

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.

node setup

Result

$\endgroup$
1
  • $\begingroup$ Great! What a nice solution! $\endgroup$
    – p6majo
    Apr 3 at 16:42
7
$\begingroup$

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.

node setup

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

$\endgroup$
4
  • $\begingroup$ 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. $\endgroup$
    – p6majo
    Apr 1 at 14:39
  • $\begingroup$ 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? $\endgroup$
    – Leander
    Apr 1 at 21:11
  • $\begingroup$ 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. $\endgroup$
    – p6majo
    Apr 2 at 7:19
  • $\begingroup$ blender.stackexchange.com/a/230945/35559 ? $\endgroup$
    – Robin Betts
    Apr 4 at 7:56
0
$\begingroup$

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): enter image description here enter image description here

$\endgroup$

Not the answer you're looking for? Browse other questions tagged .