This project is read-only.

Test whether Point is contained within ConvexHull

Jan 11, 2016 at 7:11 PM
Is there a way to test whether a point is contained within a ConvexHull? I glanced over the source code, but could not find it.
Jan 11, 2016 at 11:41 PM
If you want to use the output of the program to determine the point's position you have to write this yourself.

One way to do this:
  • Each ConvexFace defines a normal N. This can be used to determine the plane the face defines. For 3D: N[0]x + N[1]y + N[2]z + D = 0 where D = - N . P and P is an arbitrary point of the corresponding face and '.' is the dot product.
  • Now you can compute the value of N . A + D (where A is your point) for each face of the hull. Positive value means the point is "above" the plane and negative "bellow" the plane.
  • If the point is bellow all the face-planes, it is inside the hull. In other words, if you encounter a face for which the point is "above", the point is outside the hull.