length1 function
Approximate length of an elliptic orbit (Ramanujan, first approximation).
a is semimajor axis, e is eccentricity. Result in same units as a.
Implementation
double length1(double a, double e) {
final b = a * math.sqrt(1 - e * e);
return math.pi * (3 * (a + b) - math.sqrt((3 * a + b) * (a + 3 * b)));
}