length2 function
Approximate length of an elliptic orbit (Ramanujan, second approximation).
Implementation
double length2(double a, double e) {
final b = a * math.sqrt(1 - e * e);
final h = ((a - b) / (a + b));
final h2 = h * h;
return math.pi * (a + b) * (1 + 3 * h2 / (10 + math.sqrt(4 - 3 * h2)));
}