All projects

Physics simulations

Planetary Connecting Lines

Draw a straight line between Earth and Venus every few days, and after eight years the lines and their midpoints form a flower with five petals. This page draws those lines for Earth and Venus and for Earth and Mars, and explains where the petals come from: thirteen Venus years last almost exactly as long as eight Earth years, and the midpoint of the line retraces, at half size, the path of the planet across Earth’s sky.
  • Orbits
  • Geometry
  • Generative

In simple words

Think of the planets as runners on round tracks around the Sun. Venus has an inside lane and runs faster than Earth. In the time Earth runs 8 laps, Venus runs almost exactly 13, so it overtakes Earth 5 times. Every few days we draw a straight line from Earth to Venus and put a dot in the middle of it.

After eight years the lines and dots make a flower with five petals, one for each time Venus overtook Earth, and then the drawing starts again almost exactly on top of itself. Mars runs on an outer lane, slower than Earth. Its flower with Earth has many more petals and takes 79 years to close. Press Run and watch the flowers grow.

Earth-Venus-Mars-Sun VisualizationOpen on its own

Three runners on round tracks

The model keeps only what the picture needs. Venus, Earth and Mars move on circles around the Sun, in one plane, at constant speed. The periods are the sidereal periods and the radii the mean distances from NASA's planetary fact sheets [1], 224.701, 365.256 and 686.980 days and 0.723, 1.000 and 1.524 astronomical units (AU). Planet ii is then at

ri(t)=ri(cos⁡2πtTi, sin⁡2πtTi),\mathbf r_i(t) = r_i\left(\cos\frac{2\pi t}{T_i},\ \sin\frac{2\pi t}{T_i}\right),

and all three start lined up on the same side of the Sun at t=0t=0. These numbers obey Kepler's third law: in years and AU, T2/r3T^2/r^3 equals 1 to within 0.2% for all three planets. Real orbits are slightly elliptical and slightly tilted, but the eccentricities of Venus and Earth are only 0.0068 and 0.0167 [1], so for them circles in one plane are an excellent description. Mars is the exception, and we come back to it below.

Why five petals

What shapes the drawing is not the orbits themselves but how often the faster planet laps the slower one. The time between two overtakes, the synodic period SS, follows from the difference of the rates,

1S=1TV−1TE,\frac{1}{S} = \frac{1}{T_V} - \frac{1}{T_E},

which gives 583.92 days for Venus and Earth [1]. When Venus overtakes Earth the two planets are lined up on the same side of the Sun, the connecting line is short, and its midpoint is far out, 0.86 AU from the Sun. Half a synodic period later they are on opposite sides, the line is long and passes close to the Sun, and the midpoint comes within 0.14 AU of the Sun, where it turns a small loop. One synodic period draws one petal.

The five petals come from a near coincidence. Eight Earth years last 2922.05 days, thirteen Venus years 2921.11 days, and five synodic periods 2919.62 days. In eight years Venus therefore laps Earth 13−8=513-8=5 times. Each overtake happens 215.5° further round than the one before, about three fifths of a turn, so successive overtakes jump to every other corner of a pentagon, and joining them in order draws a five-pointed star, the pentagram of Venus. After the fifth overtake the pattern is back where it started, short by only 2.4°, so the whole flower turns once around the Sun in about 1200 years. With its default periods the demo reproduces this slow drift. The cycle was known long before telescopes. The Venus tables of the Maya Dresden Codex count five periods of 584 days as eight years of 365 days [2], and the Babylonian goal-year texts predicted the appearances of Venus from those eight years earlier [3].

The midpoint is an epicycle

Complex numbers make the midpoint transparent. With ωi=2π/Ti\omega_i = 2\pi/T_i,

M(t)=12(rE eiωEt+rV eiωVt),M(t) = \tfrac12\left(r_E\, e^{i\omega_E t} + r_V\, e^{i\omega_V t}\right),

a point on a small circle carried around a larger one: a deferent and an epicycle, the construction with which Ptolemy described the planets [4]. The analogy is closer than it looks. Seen from Earth, Venus is at G(t)=rVeiωVt−rEeiωEtG(t) = r_V e^{i\omega_V t} - r_E e^{i\omega_E t}. Moving the midpoint forward by half a synodic period changes the relative phase of its two terms by π\pi and turns the sum into the difference,

2 M ⁣(t+S2)=eiωVS/2  G(t).2\,M\!\left(t + \tfrac{S}{2}\right) = e^{i\omega_V S/2}\; G(t).

The midpoint therefore draws, at half size and rotated, exactly the path of Venus across Earth's sky, the path that astronomers followed for millennia and that Ptolemy reproduced with his epicycles. Its small loops are the retrograde loops of Venus, shifted by half a synodic period. The same argument turns the Earth–Mars midpoint into the path of Mars seen from Earth, with its retrograde loops at opposition. The distance of the midpoint from the Sun,

ρ2=14[r12+r22+2r1r2cos⁡((ω1−ω2) t)],\rho^2 = \tfrac14\left[r_1^2 + r_2^2 + 2 r_1 r_2 \cos\big((\omega_1-\omega_2)\,t\big)\right],

swings once per synodic period between ∣r1−r2∣/2|r_1-r_2|/2 and (r1+r2)/2(r_1+r_2)/2, from 0.14 to 0.86 AU for Earth and Venus and from 0.26 to 1.26 AU for Earth and Mars.

The faint lines add a second picture. Each line is drawn at 7% opacity, so the drawing brightens wherever many lines overlap, and the bright regions trace the envelope of the whole family of lines, a five-fold rosette for Earth and Venus. Drawings of this kind were popularized by John Martineau [5].

When the pattern closes

If the faster planet completes exactly qq orbits while the slower completes pp, the drawing closes after that time with (q−p)(q-p)-fold symmetry, one petal per overtake. For Earth and Venus, 13 against 8 gives the five petals, and setting the Venus period to exactly 8/13 of Earth's, 224.773 days, closes the flower perfectly. Earth and Mars have no small fraction close to their ratio. Fifteen Earth years fall 17 days short of eight Mars years, and after those seven overtakes the drawing has drifted by 19°. The first good return is 79 Earth years against 42 Mars years, two days apart, after 37 overtakes. The Babylonian astronomers used exactly these 79 years, and the rougher 47, as their goal-year periods for Mars [3]. The demo runs for 86 years, long enough to reach the 79-year return. A ratio that is not a fraction at all, such as the golden ratio, never closes. The midpoint then fills a ring around the Sun densely, a quasi-periodic motion that is entirely regular and not chaotic.

What the model leaves out

Two simplifications matter. All planets start in line at t=0t=0, which fixes the orientation of the drawing but not its shape. And the orbits are circles. That is harmless for Venus and Earth, but Mars has an eccentricity of 0.0935 [1], so its distance from the Sun varies between 1.38 and 1.67 AU. In the real sky its retrograde loops change size from one opposition to the next, and the real Earth–Mars drawing is lopsided. Elliptical orbits, with Kepler's equation solved at every moment, are what the binary-star page draws. The orbits of Venus and Mars are also tilted by 3.4° and 1.8° to Earth's [1], which matters for where they appear in the sky but hardly for the picture.

Inside the code

Because the orbits are circles at constant speed, every position is known in closed form. Nothing has to be integrated, and the drawing at any time can be produced directly:

// Closed-form positions: nothing is integrated, so any moment can be
// drawn at once and the time slider can jump anywhere.
function pos(T, r, t) {
  const a = (2 * Math.PI * t) / T;
  return [r * Math.cos(a), r * Math.sin(a)];
}

A long run draws many thousands of lines. The run stops at 10 000π10\,000\pi days, about 86 years, which at the default step of π\pi days is exactly ten thousand lines. Redrawing them all on every frame would be wasteful, so they go into offscreen layers, and each frame only adds what is new before the layers are composited onto the screen. Stroking each line separately at low opacity is what makes the overlaps add up:

// The history lives in offscreen layers that are drawn once. Each frame
// adds only the lines that are new since the last frame.
while (hist.next <= t) {
  const v = pos(o.pv, o.rv, hist.next), e = pos(o.pe, o.re, hist.next);
  lines.beginPath();                    // one stroke per line, at 7% opacity,
  lines.moveTo(sx(v[0]), sy(v[1]));     // so overlapping lines add up and
  lines.lineTo(sx(e[0]), sy(e[1]));     // their envelope lights up
  lines.stroke();
  hist.next += step;
}

The midpoints are plotted ten times as often as the lines, as single pixels, so their spacing shows the speed of the midpoint. Going back in time or changing an orbit clears the layers and redraws the history up to the current moment, which is quick because every point is a closed-form evaluation.

// Midpoints as 1-pixel dots, ten per line: where the dots thin out,
// the midpoint is moving fast.
for (; j <= t; j += step / 10) {
  const v = pos(o.pv, o.rv, j), e = pos(o.pe, o.re, j);
  mids.fillRect(sx((v[0] + e[0]) / 2), sy((v[1] + e[1]) / 2), 1, 1);
}

Try it yourself

Choose Earth–Venus only and press Run. The readout counts Earth years. At 1.6 years the first petal is complete, at 8 years the fifth, and the drawing then starts again almost on top of itself. Set the Venus period to 224.773 days and the flower closes exactly. Set it to 182.628 days, half an Earth year, and the midpoint draws a limaçon with an inner loop, which becomes a cardioid with a cusp when you also set the Venus radius to 0.5 AU, half of Earth's. Then try a ratio that is not a fraction, Venus at 225.741 days, Earth's period divided by the golden ratio, and the drawing never closes. For Earth and Mars, raise the speed and look for the rough 15-year return and the much better one at 79 years. Larger steps between lines give sparse, spiky drawings and small steps give smooth shading. Export PNG saves the picture without the star field.

References

  1. [1] D. R. Williams, Planetary Fact Sheets for Venus, Earth and Mars, NASA Space Science Data Coordinated Archive.
  2. [2] A. F. Aveni, Skywatchers: A Revised and Updated Version of Skywatchers of Ancient Mexico (University of Texas Press, Austin, 2001).
  3. [3] J. M. K. Gray and J. M. Steele, Studies on Babylonian goal-year astronomy I: a comparison between planetary data in Goal-Year Texts, Almanacs and Normal Star Almanacs, Arch. Hist. Exact Sci. 62, 553 (2008).
  4. [4] G. J. Toomer, Ptolemy’s Almagest (Duckworth, London, 1984).
  5. [5] J. Martineau, A Little Book of Coincidence in the Solar System (Wooden Books, 2002).