How to decide whether a given point is inside or outside a given cone?

823 Views Asked by At

Given a cone defined by peak point $(X_0,Y_0,Z_0)$, bottom point $(X_1,Y_1,Z_1)$ and radius $R$, how can I decide whether a given point $(X',Y'Z')$ is inside the cone?

enter image description here

Cone is not parallel to $XY$ plane. Cone can be at any angles based on peak point and bottom point. Could anyone please provide a solution?

1

There are 1 best solutions below

1
On BEST ANSWER

Let the cone have "peak" $(0,0,0)$, "bottom" $(0,0,1)$ and "radius" $1$, as illustrated below

enter image description here

Any other cone can be mapped to the cone above via an affine transformation. The candidate point must be transformed as well, of course.

Let the (affinely transformed) candidate point be $(x,y,z)$. If $z < 0$ or $z > 1$, we then immediately conclude that it is outside the cone. If $x^2 + y^2 > 1$, we again conclude that it is outside the cone. If $$\sqrt{x^2+y^2} \leq z \leq 1$$ then the candidate point is inside the cone. The difficulty is in finding the affine transformation.