1

How to find the length of arc of an ellipse?

Inputs are

a = length of major axis
b = length of minor axis
c = angle from X axis

Please note that full perimeter is

PI * ( 3*(a + b) - SQRT( (3*a + b) * (a + 3*b) ) )

What I want is length of PART of perimeter of ellipse.

  • I think information is missing on the orientation of the ellipses axis relative to the X axis. Taht is assuming that the "angle from X axis" is the info on which part of the ellipse is analysed. Otherwise it is the other way. I.e. oritentation is there but info on the part is missing. – Yunnosch Oct 22 '20 at 06:11
  • 3
    Make integration along ellipse arc length to get numerical solution. Note that your formula is just Ramanujan approximation (there is no exact formula for ellipse perimeter, it might be expressed using so called elliptic integrals) – MBo Oct 22 '20 at 06:21

1 Answers1

2

This might seem like pure math problem at first but it isn't.

Because this problem is unsolvable by standard algebraic math methods (no goniometrics will help at least we still do not know the correct answer/equation) as we simply do not know what the perimeter of ellipse is. All the equations you can find (the one you posted including) are just approximations suited for specific ranges of eccentricity (so they are not precise and their error is getting bigger for ellipses with different eccentricity)!!!

Integration along perimeter is possible (curve integral) however IIRC it leads to non integrable therms so you need to use numeric methods instead (where programming comes in).

The easiest method of computing arc-length is to convert your elliptic arc to set of very small lines and sum their lengths in some for loop using parametric ellipse equation.

Now its just a matter of selecting the number of lines or method of numeric integration so you meet your accuracy requirements...

Orientation of ellipse is meaningless for this problem as your arc starts from major axis... so you can solve it as it is always axis aligned.

Here simple C++ example using the lines:

int e;
float a=?,b=?,ang=?,l,aa,da=0.001*M_PI,x,y,x0,y0;
aa=0.0;                                    // starting angle
x=a*cos(aa);                               // starting point
y=b*sin(aa); 
for (e=1,l=0.0;e;)
 {
 aa+=da; if (aa>=ang){ e=0; aa=ang; }      // ending angle reached?
 x0=x; x=a*cos(aa);                        // 2 consequent points on ellipse (line)
 y0=y; y=b*sin(aa);
 l+=sqrt(((x-x0)*(x-x0))+((y-y0)*(y-y0))); // add line length to arclength
 }

where a,b are your semi-axises, ang is angular size of your arc and l is your arc-length. The da is the integration step the smaller it is the better accuracy but longer computation...

I typed this code directly in SO editor so it might contain syntax errors...

btw here few QAs related to ellipse perimeter problem for inspiration:

Spektre
  • 49,595
  • 11
  • 110
  • 380