In standard form:
When is not the centre of the ellipse, but rather an arbitrary point then:
such that the equation becomes:
where represents an arbitrary point on the ellipse perimeter.
float wasElipseCircumference(float a, float b, integer precision) { float x = llListStatistics(LIST_STAT_MAX, [a, b]); float y = llListStatistics(LIST_STAT_MIN, [a, b]); float tol = llSqrt(llPow(.5, precision)); if (precision * y < tol * x) return 4 * x; float s = 0; float m = 1; while (x - y > tol * y) { x = .5 * (x + y); y = llSqrt(x * y); m *= 2; s += m * llPow(x - y, 2); } return PI * (llPow(a + b, 2) - s) / (x + y); }