Intersection of a line and cone

407 Views Asked by At

I am trying to find the intersection of a line going through a cone. It is very similar to Intersection Between a Line and a Cone however, I need the apex to be at the origin.

Consider a Point, e, outside of the cone with direction unit vector, v. I know the equation of this line would be P + v*d, where d is the distance from the starting point. Consider the unit direction vector of the cone as a. I used the equations from the question referenced above in order to solve for a d that intersects with the cone.

d = (B1/B2) +/- sqrt(B1^2 - B0B2)/B2, which is essentially just the quadratic equation solving B2d^2 - 2B1d + B0, where

B2 = Px^2 + Py^2 + Pz^2 - R1^2*Z1^2

B1 = Z1R1(Z0R1 + R0) - PxQx - PyQy - PzQz

B0 = Qx^2 + Qy^2 + Qz^2 - (R1Z0 + R0)^2

Now, the derivations that lead to these equations assume the cone base is centered at (0,0,0), which is where I need to differentiate. The equations for R1, R0, Z1, and Z0 goes as follows:

R0 = r (radius of cone base)

R1 = -R0/h

Z0 = e dot a(unit direction of cone)

Z1 = v dot a

So, then the derivation compares a point p(d) away from the cone base as ||p(d) - za||^2 = r(x)^2. Making the equation p(d) - za = e + d*v - (Z1d + Z0)a. Simplifying we get Pd + Q, where P = v - Z1a and Q = e - Z0a.

In order to meet the "flipped" cone where the apex is at the origin though, I inverted the unit vector of the cone (multiplied its unit direction vector by -1) and added an offset h to the x direction of the Point, P. This is assuming h (the height of the cone) is along the positive x axis.

Is this the best way to convert the math from above to the context that I need here or is there a different way to derive the equations? I have a feeling it is something to do with the p(d) + za = r(x) equation, where the derivation starts. The way I solved it does not seem very efficient, any help would be much appreciated.

Line coming from behind cone apex intersecting the cone

1

There are 1 best solutions below

0
On

Plugging the parametric equation of the line (point $p$, direction vector $\vec t$) in the implicit equation of the double cone $$x^2+y^2=z^2\tan^2\phi$$ you get a quadratic equation in $\lambda$

$$(p_x+\lambda t_x)^2+(p_y+\lambda t_y)^2=(p_z+\lambda t_z)^2\tan^2\phi$$

or

$$(t_x^2+t_y^2-t_z'^2)\lambda^2+2(p_xt_x+p_yt_y-p_z't_z')\lambda+p_x^2+p_y^2-p_z'^2=0$$ where the prime denotes multiplication by $\tan\phi$.

Solve for $\lambda$, and check that $z$ is on the positive side.