On Looking for The Eclipse

Ensemble au clair-obscur

The orbits of the two bodies are elliptical and centered about the origin. In other words, they are expressed using the following function of time: u*cos(ωt)+v*sin(ωt); where

  • u and v are two non-colinear vectors.
  • ω is the frequency of the orbit.
  • t is the time shown on the module.

However, for this function to be usable, each position must be converted into (x,y,z) form, from (δ,φ,θ). To convert between the two, observe the following relations:

  • x = δ*cos(φ)*cos(θ)
  • y = δ*sin(φ)*cos(θ)
  • z = δ*sin(θ)
  • δ = sqrt(x^2+y^2+z^2)
  • φ = atan2(y,x)
  • θ = asin(z/δ)

Then, to find the ellipse in 3D space, the ellipse within the plane it resides in must be found. To do this, first gather 5 points on the ellipse, and project them onto their common plane. Note that this plane always includes the origin.

After that, calculate 6 values using 6 matrices with the following criteria:

  • The first matrix has rows in the form [xi^2, xi*yi, yi^2, xi, yi] for each point (xi, yi).
  • Each matrix after that has each entry within each row, in reading order, replaced with 1.
    • For example, the first matrix created in this step has each row as [1, xi*yi, yi^2, xi, yi]
  • Label each matrix created, in order, as W, WA, WB, WC, WD, WE.
  • Calculate the following values:
    • A = det(WA)/det(W)
    • B = det(WB)/det(W)
    • C = det(WC)/det(W)
    • D = det(WD)/det(W)
    • E = det(WE)/det(W)
    • F = -A*xi^2-B*xi*yi-C*yi^2-D*xi-E*yi
  • F should always be -1.

This results in the coefficients for the ellipse equation Ax2+Bxy+Cy2+Dx+Ey+F=0. The center of such an ellipse is O(xO,yO), with the semimajor and semiminor axes at points u=(xu,yu) and v=(xv,yv), rotated by some angle Θ satisfying:

  • Δ = B^2-4*A*C
  • α = A*E^2+C*D^2-B*D*E+Δ*F
  • β = B^2+(A-C)^2
  • a = -sqrt(2*α*(A+C+sqrt(β)))/Δ
  • b = -sqrt(2*α*(A+C-sqrt(β)))/Δ
  • Θ = atan2(-B,C-A)
  • xO = (2*C*D-B*E)/Δ
  • yO = (2*A*E-B*D)/Δ
  • xu = a*cos(Θ)
  • yu = a*sin(Θ)
  • xv = -b*sin(Θ)
  • yv = b*cos(Θ)

After finding the points and vectors necessary for such an ellipse, unproject them back into 3D space using the local origin and basis vectors used to project them earlier. This results in u and v for an ellipse revolving in 3D. Note that, after unprojecting, O should always land on the origin.

After finding the ellipses, calculate the frequency of the orbit by calculating the phase difference of two points on the orbit, and dividing by the shown time difference. To find the phase of a point P (treated as a vector in this section), calculate the following:

  • α = u*u
  • β = u*v
  • γ = v*v
  • Δ = α*γ-β^2
  • cos(ωt) = (γ*u*P-β*v*P)/Δ
  • sin(ωt) = (-β*u*P+α*v*P)/Δ
  • t = atan2(sin(ωt),cos(ωt))/ω
    • t = t+2*k*π/ω
    • k ∈ Z

After finding the two ellipses, determine the line spanning the intersection of the two planes the two ellipses are contained in. A vector spanning this line can be found by calculating the cross product of the two normal vectors of the two planes.

Then, find the point of intersection between the line (spanned by l) and the ellipse via the following:

  • α = l/norm(l)
  • β = norm(u)
  • γ = norm(v)
  • P = β^2*γ*α/sqrt(β^2*γ^2+(β^2-γ^2)norm(cross(α,u))^2)

After doing so, for each ellipse, replace u with the point shown on the module at t=0, and recalculate v=(P-u*cos(ω))/sin(ω) with the point P shown at t=1.

Find the phase of one of the orbits at which the point occurs using the steps above, and offset it as defined above until the two orbits eclipse. The two bodies are defined as eclipsing each other if their φ and θ angles are offset from each other (with wraparound by ) by at most 0.05 radians.

After finding a suitable time, adjust the displayed time to match, and the viewfinder angles to be somewhere in between the two corresponding angles calculated.

At this point, the module should solve.

A reminder on what the buttons do:

Outer Buttons

+P+Vθ+T
+Vφ-Vφ
-T-Vθ-P

Inner Buttons

T
P

On Projecting Points to Planes

Choose a point within the plane to act as the origin, and two orthonormal basis vectors within the plane. Express each point as a linear combination of the two basis vectors. This results in the coordinate of the point, projected onto the plane.

Note: The two ellipses’ planes always have (0,0,0) as part of their planes.