How to find whether a point in a 3D space lies inside a hemisphere?
3d, algorithm, math, vector-graphics
Solution
Let us call your point (a,b,c). Note that a hemisphere is the intersection of a half-space and a sphere. So we just test intersection with both and AND the result. First test whether the point is on the right side of the half-space:
dy = y2-y;
if (b-y)*dy<0 then
return no intersection
This uses the fact that the distance of the tip to the center will have a different sign than the distance of the point to the center only if the test point is in the wrong half-space.
Then check versus the sphere. This is inferred from the distance of the tip to the center:
squareDistance = (x-a)²+(y-b)²+(z-c)²;
if squareDistance > dy² then
return no intersection
else
return intersection
Problem
``` Tip of the hemisphere - (x,y2,z) Mid point of the circle in the hemisphere - (x,y,z) ``` As x,y,z and y2 can be anywhere in the 3D space, the hemisphere could point any direction and so I am struggling with the direction part. I can't solve this similar to a cone, sphere or a truncated cone.