1

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?

manoos
  • 115
  • radius? How does a cone have a radius? – Angina Seng Jan 03 '18 at 05:09
  • This is not a cone in the mathematical sense. In any event, there are equations that describe the object and a point lines in the object iff it satisfies all of the constituent equations. – copper.hat Jan 03 '18 at 05:22
  • Can you give us some context? What have you tried? Hint: project $P=(X', Y', Z')$ onto the line defined by $(X_0, Y_0, Z_0)$ and $(X_1, Y_1, Z_1)$ and check the position of the projection and the distance of $P$. – user251257 Jan 03 '18 at 05:44
  • Find the axis of the cone and see if the angle that the ray from the apex to the point makes with the axis is less than the cone’s angle. You can do this with dot products. – amd Jan 03 '18 at 07:14
  • @user251257: I need to check point P=(X′,Y′,Z′)P=(X′,Y′,Z′) is inside or outside a cone with apex is at (X0,Y0,Z0) and base point is at (X1,Y1,Z1). How can I check? – manoos Jan 03 '18 at 23:27
  • @amd : I think your suggestion will work for my case... I will check. Thank You – manoos Jan 03 '18 at 23:28
  • If you really only want one nappe of the cone, then you’ll also need to examine the sign of the dot product. If the cone also has finite extent, as you’ve pictured it, the dot product again will let you test for that distance as well. – amd Jan 04 '18 at 00:01

1 Answers1

1

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.