Note

This Mathematica notebook is from the WWW project A Visual Dictionary of Special Plane Curves. Copyright © 1995-2000 by Xah Lee. (http://xahlee.org/)

Mathematics of Conic Section

This notebook contain derivations of metric relations of elements in a conic section. For example, given a cone and a plane, 
* What is the essentricity of the conics so formed?
* What are the centers and radiuses of its Dandelin spheres?
* What are the distances from the vertex of the cone to the foci?
Besides being a mathematical problem, answers to these questions are needed in writing programs that generates 3D illustrations about conic section.

Symbols Used

Let α be the principle angle of the axis of the cone and its elements. (angle v1 v0 b0) α ≤ π/2.
Let θ be the principle angle of the axis and the cutting plane. (angle c2 b0 v2). θ ≤ π/2.
Let v0 be the vertex of the cone.
Let n0 be the point on the cutting plane nearest to v0.
Let v0n0 be the distance from the vertex of the cone to the cutting plane. (note: given α and θ, the essentricity of the conics is uniquely defined. Given α, θ, and v0n0, it's scale is also uniquely defined. )
Let v1 and v2 be the vertexes of the conic section. (labeled so that v1 is closer to v0) (v1 and v2 is the nearest and farthest points on the conic section to v0, respectively)
Let f1 and f2 be the foci of the conic section. (labeled so that f1 is closer to v1)(this is where the Dandelin spheres touches the cutting plane)(if it is a parabola, f2 and v2 are at Infinity)
Let c0 be the center of the conic section. (this is the midpoint between v1 and v2)
Let b0 be the point where the axis of the cone intersects the cutting plane.
Let v0v1 be the distance from v0 to v1.
Let v0v2 be the distance from v0 to v2.
Let c1 be the center of the smaller tangent circle.
Let c2 be the center of the other tangent circle. (tangent circles are the intersections of the cone and the Dandelin spheres)
Let j1 be a point on the smaller tangent circle nearest to v1. (if θ ==π/2, then there's no nearest point. Then pick any point on the tangent circle for j1. The exact position of j1 is not important. We just want a lable so we can consistantly write its radius of tangent circle as c1j1. Similar things can be said for j2.)
Let j2 be a point on the larger tangent circle nearest to v2.
Let c1j1 and c2j2 be the radiuses of the tangent circles.
Let s1 and s2 be the centers of Dandelin spheres.
Let s1j1 and s2j2 be the radiuses of the first and second Dandelin spheres.
Let v0s1 be the distance from v0 to s1.
Let v0s2 be the distance from v0 to s2.
Let v0c1 be the distance from the v0 to c1.
Let v0c2 be the distance from the v0 to c2.

Derivations

Given apha, θ, and v0n0, all the distances between important points are defined.
We don't really care about the coordinates of these points, but rather the distances between them, because coordinates can vary depending on the position and orientation of the double cone but distances and angles between them are invariant. But to help find these distances, we'll put the whole thing in a 2D coordinate system. Let v0 be at the origin. Let the axes of the cone be the y-axes. The cutting plane is then
y == -Tan[(π/2) - θ] x + (v0n0/Sin)[θ]
The double cone is then
y == Tan[(π/2) - α] xy == -Tan[(π/2) - α] x

v0 = {0,0};

Solving these equations to get the vertexes of the conic section.

Simplify[
      Solve[{y == -Tan[(π/2) - θ] x + (v0n0/Sin)[θ], 
          y == Tan[(π/2) - α] x}, {x, y}]]Simplify[
      Solve[{y == -Tan[(π/2) - θ] x + (v0n0/Sin)[θ], 
          y == -Tan[(π/2) - α] x}, {x, y}]]

v1
       = {v0n0 Csc[α + θ] Sin[α], 
        v0n0 Cos[α] Csc[α + θ]}; v2
       = {v0n0 Csc[α - θ] Sin[α], 
        -(v0n0 Cos[α] Csc[α - θ])};

This result is not surprizing. Observe that they have the form 
c {Sin[t],Cos[t]}, where c is the distance from the conics' vertex to the cone's vertex.
If we approach the problem using synthetic geometry, we'd get the same result perhaps faster and with understanding.
Knowing the coordinates for v1 and v2, we can use distance formula to calculate v0v1, v0v2, and v1v2.

Simplify[(Sqrt[Plus])@@(((v0 - v1))^2)]Simplify[(Sqrt[Plus])@@(((v0 - v2))^2)]Simplify[(Sqrt[Plus])@@(((v1 - v2))^2)]

v0v1 = (Sqrt[(v0n0^2) Csc[α + θ]^2]); v0v2 = (Sqrt[(v0n0^2) Csc[α - θ]^2]); v1v2 = 
      (Sqrt[(v0n0^2) Csc[α - θ]^2 Csc[α + θ]^2 
          Sin[2 α]^2]);

Now let's find the coordinates for n0.
The angle {1,0}, {0,0}, and n0 has degree θ.
So n0 is {Cos@ θ, Sin@ θ}* v0n0.

n0 = {Cos[θ], Sin[θ]} v0n0;

c0 is a point between v1 and v2, therefore c0 = (v1+v2)/2.

Simplify[((v1 + v2)/2), Trig -> True]

c0
       = {v0n0 Cos[θ] Csc[α - θ] 
          Csc[α + θ] Sin[α]^2, 
        -v0n0 Cos[α]^2 Csc[α - θ] 
          Csc[α + θ] Sin[θ]};

c0v1 is calculated by distance formula.

Simplify[(Sqrt[Plus])@@(((v1 - c0))^2)]

c0v1 = 
      (1/2) (Sqrt[(v0n0^2) Csc[α - θ]^2 
            Csc[α + θ]^2 Sin[2 α]^2]);

Since the conics so cut will have eccentricity e := Cos[θ]/Cos[α], and we know that e = c/a, so c = a e. Now we know both a and e. In our context, a is c0v1 and c is c0f1. c0f1 is then c0v1 Cos[θ]/Cos[α].

Simplify[((c0v1 Cos[θ])/Cos)[α], Trig -> True]

c0f1 = 
      (1/2) Cos[θ] Sec[α] 
        (Sqrt[(v0n0^2) Csc[α - θ]^2 
            Csc[α + θ]^2 Sin[2 α]^2]);

To find the coordinates of f1 and f2, we use concept of vectors. If V is the unit vector of v1-c0, f1 is then V* c0f1 + c0. Similarly for f2.

unitV[v_]:= v/Sqrt[v.v]

Simplify[ unitV[v1-c0] c0f1 + c0]

f1
       = {(1/2) v0n0 Cos[θ] Csc[((α + θ)/2)] 
          Sec[((α - θ)/2)] Sin[α], 
        v0n0 Csc[α - θ] Csc[α + θ] 
          (Cos[θ]^2 Sin[α] - 
              Cos[α]^2 Sin[θ])};

Simplify[ unitV[v2-c0] c0f1 + c0]

f2
       = {(1/2) v0n0 Cos[θ] Csc[((α - θ)/2)] 
          Sec[((α + θ)/2)] Sin[α], 
        -v0n0 Csc[α - θ] Csc[α + θ] 
          (Cos[θ]^2 Sin[α] + 
              Cos[α]^2 Sin[θ])};

Use distance formula to calculate the distance from v0 to f1 or f2, and v1f1.

Simplify[(Sqrt[Plus])@@(((f1 - v0))^2)]

v0f1 = 
      ((Sqrt[-(v0n0^2) 
            (-3 + Cos[2 α] - 2 Cos[α - θ] + 
                2 Cos[α + θ]) 
            Csc[((α + θ)/2)]^2 
            Sec[((α - θ)/2)]^2])/(2 (Sqrt[2])));

Simplify[(Sqrt[Plus])@@(((f2 - v0))^2)]

v0f2 = 
      ((Sqrt[-(v0n0^2) 
            (-3 + Cos[2 α] + 2 Cos[α - θ] - 
                2 Cos[α + θ]) 
            Csc[((α - θ)/2)]^2 
            Sec[((α + θ)/2)]^2])/(2 (Sqrt[2])));

Simplify[(Sqrt[Plus])@@(((f1 - v1))^2)]

v1f1 = 
      (1/2) (Sqrt[(v0n0^2) Sec[((α - θ)/2)]^2 
            Sec[((α + θ)/2)]^2 Sin[α]^2]);

Use analytic geometry to find b0 (the intersection of the cutting plane and the axis of the cone), by solving the system of equation x==0, and equation of the cutting plane
y == -Tan[Pi/2-θ] x + v0n0/Sin[θ]

b0 = {0, v0n0 Csc[θ]}; v0b0 = Abs[v0n0 Csc[θ]];

Coordinates for s1 and s2 can also be found by solving system of linear equations.

s1
       = {0, (1/2) v0n0 Csc[((α + θ)/2)] 
          Sec[(1/2) (-α + θ)]}; s2
       = {0, -(1/2) 
          (v0n0 Csc[((α - θ)/2)] 
              Sec[((α + θ)/2)])};

s1j1 = 
      Abs[(1/2) v0n0 Csc[((α + θ)/2)] 
          Sec[((α - θ)/2)] Sin[α]]; s2j2 = 
      Abs[(1/2) v0n0 Csc[((α - θ)/2)] 
          Sec[((α + θ)/2)] Sin[α]];

v0s1 = 
      (1/2) v0n0 Csc[((α + θ)/2)] 
        Sec[(1/2) (-α + θ)]; v0s2 = 
      -(1/2) 
        (v0n0 Csc[((α - θ)/2)] 
            Sec[((α + θ)/2)]);

We know that v0, s1, and j1 forms a right triangle, and we know one side v0s1, and the angle at v0 to be α. so that
v0j1 == v0s1 Cos[α]
v0j2 == v0s2 Cos[α]

v0j1 = 
      (1/2) (v0n0 Csc[((α + θ)/2)] 
            Sec[(1/2) (-α + θ)]) Cos[α]; v0j2 = 
      -(1/2) 
        (v0n0 Csc[((α - θ)/2)] 
            Sec[((α + θ)/2)]) Cos[α];

Now c0, s1, and j1 is a right triangle too. Same method we use to find v0c1 and v0c2. They are
v0c1 == v0j1 Cos[α]
v0c2 == v0j2 Cos[α]
c1j1 == v0j1 Sin[α]
c2j2 == v0j2 Sin[α]

v0c1 = 
      (1/2) (v0n0 Csc[((α + θ)/2)] 
            Sec[(1/2) (-α + θ)]) Cos[α]^2; 
    v0c2 = 
      -(1/2) 
        (v0n0 Csc[((α - θ)/2)] 
            Sec[((α + θ)/2)]) Cos[α]^2;

c1j1 = 
      (1/2) (v0n0 Csc[((α + θ)/2)] 
            Sec[(1/2) (-α + θ)]) Cos[α] 
        Sin[α]; c2j2 = 
      -(1/2) 
        (v0n0 Csc[((α - θ)/2)] 
            Sec[((α + θ)/2)]) Cos[α] Sin[α];

b0, d1, c1 forms a right triangle with the angle b0,d1,c1 == (π/2) - θ.
Since we know v0b0 and v0c1, so one side is v0b0-v0c1. We can thus solve for the side c1d1 and also find the coordinate for d1. Another way to find the coordinate of d1 is solve the equation of the cutting plane and the line passing through c1 and d1. That is
Solve[{y == -Tan[Pi/2-θ] x + v0n0/Sin[θ],y == v0c1},{x,y}]

c1d1 = (v0b0-v0c1)/Tan[Pi/2-θ];
d1 = {c1d1,v0c1};

By simple principle of linear algebra, we have d2 = (c0 - d1) + c0.

d2 = (c0 - d1) + c0;

Summary of Results

Every thing we found above is summarized here.

\(Off[General::spell]; 
Clear[α, θ, v0n0]; 

    Clear[v0\ , \ v1\ , \ v2\ , \ v0v1\ , \ v0v2\ , \ v1v2\ , \ n0, \ c0\ , \ 
      c0v1\ , \ c0f1, 
f1\ , \ f2\ , \ v0f1\ , \ v0f2\ , \ v1f1, \ b0, \ 
      v0b0, \ s1, \ s2, \ s1j1, \ s2j2, 
v0s1, \ v0s2, \ v0j1, \ v0j2\ , \ 
      v0c1, \ v0c2\ , \ c1j1\ , \ c2j2, \ c1d1\ , \ d1, \ d2]; 


    v0 = {0, 0}; 

    \(v1 = {v0n0\ Csc[α + θ]\ Sin[α], 
        v0n0\ Cos[α]\ Csc[α + θ]}; \)\)\(v2 = {v0n0\ Csc[α - θ]\ Sin[α], 
        \(-\((v0n0\ Cos[α]\ Csc[α - θ])\)\)}; 

    v0v1 = \@\(v0n0\^2\ Csc[α + θ]\^2\); 

    v0v2 = \@\(v0n0\^2\ Csc[α - θ]\^2\); 

    v1v2 = \@\(v0n0\^2\ Csc[α - θ]\^2\ 
          Csc[α + θ]\^2\ Sin[2\ α]\^2\); 

    n0 = {Cos[θ], Sin[θ]}\ v0n0; 

    \(c0 = {v0n0\ Cos[θ]\ Csc[α - θ]\ 
          Csc[α + θ]\ Sin[α]\^2, 
        \(-v0n0\)\ Cos[α]\^2\ Csc[α - θ]\ 
          Csc[α + θ]\ Sin[θ]}; \)\)c0v1 = 
      (1/2) (Sqrt[(v0n0^2) Csc[α - θ]^2 
            Csc[α + θ]^2 Sin[2 α]^2]); c0f1 = 
      (1/2) Cos[θ] Sec[α] 
        (Sqrt[(v0n0^2) Csc[α - θ]^2 
            Csc[α + θ]^2 Sin[2 α]^2]); f1
       = {(1/2) v0n0 Cos[θ] Csc[((α + θ)/2)] 
          Sec[((α - θ)/2)] Sin[α], 
        v0n0 Csc[α - θ] Csc[α + θ] 
          (Cos[θ]^2 Sin[α] - 
              Cos[α]^2 Sin[θ])}; f2
       = {(1/2) v0n0 Cos[θ] Csc[((α - θ)/2)] 
          Sec[((α + θ)/2)] Sin[α], 
        -v0n0 Csc[α - θ] Csc[α + θ] 
          (Cos[θ]^2 Sin[α] + 
              Cos[α]^2 Sin[θ])}; v0f1 = 
      (1/(2 (Sqrt[2]))) 
        (√(
              -(v0n0^2) 
                (-3 + Cos[2 α] - 2 Cos[α - θ] + 
                    2 Cos[α + θ]) 
                Csc[((α + θ)/2)]^2 
                Sec[((α - θ)/2)]^2)); v0f2 = 
      (1/(2 (Sqrt[2]))) 
        (√(
              -(v0n0^2) 
                (-3 + Cos[2 α] + 2 Cos[α - θ] - 
                    2 Cos[α + θ]) 
                Csc[((α - θ)/2)]^2 
                Sec[((α + θ)/2)]^2)); v1f1 = 
      (1/2) (Sqrt[(v0n0^2) Sec[((α - θ)/2)]^2 
            Sec[((α + θ)/2)]^2 Sin[α]^2]); b0 = {0, v0n0 Csc[θ]}; \(v0b0 = Abs[v0n0\ Csc[θ]]; 

    s1 = {0, 1\/2\ v0n0\ Csc[\(α + θ\)\/2]\ 
          Sec[1\/2\ \((\(-α\) + θ)\)]}; 

    s2 = {0, \(-\(1\/2\)\)\ 
          \((v0n0\ Csc[\(α - θ\)\/2]\ 
              Sec[\(α + θ\)\/2])\)}; 

    s1j1 = Abs[
        1\/2\ v0n0\ Csc[\(α + θ\)\/2]\ 
          Sec[\(α - θ\)\/2]\ Sin[α]]; 

    s2j2 = Abs[
        1\/2\ v0n0\ Csc[\(α - θ\)\/2]\ 
          Sec[\(α + θ\)\/2]\ Sin[α]]; 

    v0s1 = 1\/2\ v0n0\ Csc[\(α + θ\)\/2]\ 
        Sec[1\/2\ \((\(-α\) + θ)\)]; 

    v0s2 = \(-\(1\/2\)\)\ 
        \((v0n0\ Csc[\(α - θ\)\/2]\ 
            Sec[\(α + θ\)\/2])\); 

    v0j1 = 1\/2\ 
        \((v0n0\ Csc[\(α + θ\)\/2]\ 
            Sec[1\/2\ \((\(-α\) + θ)\)])\)\ Cos[α]; 

    v0j2 = \(-\(1\/2\)\)\ 
        \((v0n0\ Csc[\(α - θ\)\/2]\ 
            Sec[\(α + θ\)\/2])\)\ Cos[α]; 

    v0c1 = 1\/2\ 
        \((v0n0\ Csc[\(α + θ\)\/2]\ 
            Sec[1\/2\ \((\(-α\) + θ)\)])\)\ Cos[α]\^2; 

    v0c2 = \(-\(1\/2\)\)\ 
        \((v0n0\ Csc[\(α - θ\)\/2]\ 
            Sec[\(α + θ\)\/2])\)\ Cos[α]\^2; 

    c1j1 = 1\/2\ 
        \((v0n0\ Csc[\(α + θ\)\/2]\ 
            Sec[1\/2\ \((\(-α\) + θ)\)])\)\ Cos[α]\ 
        Sin[α]; 
    c2j2 = \(-\(1\/2\)\)\ 
        \((v0n0\ Csc[\(α - θ\)\/2]\ 
            Sec[\(α + θ\)\/2])\)\ Cos[α]\ Sin[α]; 
    
c1d1 = \(v0b0 - v0c1\)\/Tan[π\/2 - θ]; 

    \(d1 = {c1d1, v0c1}; \)\)\(d2 = \((c0 - d1)\) + c0; 

On[General::spell]; \)