Currently, the ellipses shown for L4 and L5 do not exactly match the paths of the points.
inc-cmmn.js & inc-grfx.js
and wants styles-a.css, both found
in communal.zip and your Web cache.
This shows a primary body M and a secondary body m, separation D, indicating their motion around their barycentre C, with M×R = m×r.
The large diagram below will show how a two-body system with its five Lagrange Points rotates about its barycentre C, and what happens as the ratio of the masses is changed.
It uses G M m / D2 = F = m ω2 r = M ω2 R for ω = 1 , M + m = 1 , R + r = D , with the knowledge that the orbits are ellipses and L4 & L5 are at equilateral points, and with the geometry of ellipses.
The results agree with Full Calculator, although the calculation was written independently.
Ellipses currently drawn for L4 L5 (with the same focus and ellipticity, and axes at 60°, and matching perigees) do not exactly match the paths of L4 L5. That needs more thought.
Initially, the controls were read only before any drawing. Now, all except "Mass Ratio", "Exchange", "Rotation", and "Number of Steps" are read at each step of the drawing.
The plot is "Plot Size" pixels square.
With "Exchange", the mass ratio varies non-linearly to the given value from its reciprocal, in a given number of "Steps".
With "Rotation", for circular orbits, "Separation" is the distance between the bodies, and for elliptical orbits, it may be the latus rectum. The checkbox marked "?" selects a co-rotating, otherwise a static, observer.
Eccentricity : circle 0.0, ellipse, parabola 1.0, hyperbola. Curves for eccentricity near or over 1.0 may not be attempted.
For Eccentricity=0.0, the units of Turn are radians per step. In general, it may well represent angular momentum.
The brown discs represent the masses M1 & M2; M1 + M2 = 1. Their sizes are scaled assuming equal density (the size scale is arbitrary - at default plot size, real Solar System masses are much smaller in proportion to the distances).
The barycentre (BC) is at the centre of the square, marked by a small black yellow-centred ring. The masses are at R1 & R2 from BC.
When using the "M" and "L" checkboxes, the non-dashed curves show the paths of the masses and Lagrange points around the barycentre.
When using "Show Sep'ns", the dashed circles have radius equal to the separation of the masses. The blue ones are centred on the masses, and thus cross at L4 & L5 (note the two equilateral triangles). The red one is centred on the barycentre.
The five red "+" signs show the Lagrange points. The angles of the triangles, except for those involving BC, are multiples of 30°
The label pairs L2/L3 and L4/L5 exchange when the mass ratio crosses unity.
NOTE : The barycentre is at (0, 0). For simplicity, rotation is achieved by rotating the coordinates, which is why the text co-rotates.
See also in Scripted Drawing and PNG File.