3
$\begingroup$

Consider a canonical elliptical cone $C$ with its vertex at the origin, with height $h,$ and with a base given by: \begin{equation*} \left(\frac{x}{a}\right)^2+\left(\frac{y}{b}\right)^2=1;~z=h \end{equation*} for $a, b$ not equal to $0$. Given a point $p=(p_x,p_y,p_z)$, how would you determine if $p$ is interior to $C$? I realise I can first check to see if $p$ is outside of the elliptical right cylinder where one base the base of the elliptical cone and the other is on the $XY$ plane, so for grins, assume that check has already been made, and $p$ is in fact inside that cylinder. The most obvious solution I see is to linearly scale $a$ and $b$ by $\frac{p_z}{h}$ and see if $p$ is inside the ellipse: \begin{equation*} \left(\frac{h}{p_z}\right)^2\left[\left(\frac{x}{a}\right)^2+\left(\frac{y}{b}\right)^2\right]=1;~z=p_z. \end{equation*} Are there other approaches? Thanks.

  • 0
    Any other approach is going to be equivalent to the one you already have, so I'm not sure what you're looking for here.2010-10-01
  • 1
    I'd say you need to clarify your question. All I see is an ellipse at height h, according to your first equation. I assume the height of your cone is h and its base is given by the ellipse equation? Anyhow, if this is the case, all you need to check is that p_z in [0,h] and ((p_x)/a')^2 + ((p_y)/b')^2 < 1, where a'=a(h-z)/h, similarly for b', which is rescaling indeed.2010-10-01
  • 0
    @Rahul: It's for a digital modeling project I'm working on, and I was hoping to see if there were other approaches that I could implement that might perform better.2010-10-01

1 Answers 1

7

Write down the equation for the cone: it is $$(x/a)^2 + (y/b)^2 - (z/h)^2 = 0.$$ Now the interior of the cone will be defined by the inequalities $$(x/a)^2 + (y/b)^2 - (z/h)^2 < 0 \text{ and } 0 < z < h.$$ So given a point $(x,y,z)$, assuming that $0 < z < h$ (so that at least the $z$-coordinate is compatible with lying in the interior of the cone), you evaluate $(x/a)^2 + (y/b)^2 - (z/h)^2$ and consider whether or not it is negative.

This is of course just a rephrasing of the description you give in your post, but it is the most practical test that I can think of, and should be easy to program.

NB: I am writing $(x,y,z)$ rather than $(p_x,p_y,p_z)$ just to make the notation simpler.