Hi all,
I'm having trouble figuring out how to find whether a point is within the convex hull of a number of 3D objects defined by functions in 3D space. There can be any number of functions, which don't need to be symmetric. An object is defined by a function describing if a test point is within the object or not. An example for a sphere might be:
Likewise, the within() function for a solid box would be:
So, does anyone know how to determine an equivalent within() function for the convex hull of a combination of these functions?
I'm having trouble figuring out how to find whether a point is within the convex hull of a number of 3D objects defined by functions in 3D space. There can be any number of functions, which don't need to be symmetric. An object is defined by a function describing if a test point is within the object or not. An example for a sphere might be:
C:
bool within(Point3f p)
{
p = tform * p; // tform performs the reverse rotatation, translation and scale on the test point (instead of on the object)
return (p.x*p.x + p.y*p.y + p.z*p.z) <= 1; // the transformed test point can then be tested against a radius 1 sphere, at the origin
}
C:
bool within(Point3f p)
{
p = tform * p;
return p.x >= 0 && p.x <= 1 && p.y >= 0 && p.y <= 1 && p.z >= 0 && p.z <= 1;
}