Google Answers Logo
View Question
 
Q: Calculating arc lengh on ellipse, calculating start and end points worked exampl ( Answered,   3 Comments )
Question  
Subject: Calculating arc lengh on ellipse, calculating start and end points worked exampl
Category: Science > Math
Asked by: craigangus-ga
List Price: $30.00
Posted: 08 Oct 2004 16:39 PDT
Expires: 07 Nov 2004 15:39 PST
Question ID: 412271
I need to work out the length of an arc on an ellipse. I know the
formula but its been so long since i have done integration taht I cant
remember how to do it and I need it done quick! 

what I am looking for is a worked example with actual numbers in it.
say for an ellipse of 36 wide and 25 high

I need to the following worked out.
-Length of arc on ellipse
-How to work out the coordinates start and end point of teh arc on
ellipse from given co ordinate

This is for a program that writes text along the circumference of an oval

Request for Question Clarification by leapinglizard-ga on 08 Oct 2004 16:58 PDT
I understand that you want to know the length of an arc on an ellipse,
as well as the coordinates of its endpoints.

What I can't quite tell from your description is how you specify the
arc. Do you give a pair of angles, for instance, between which the arc
lies?

leapinglizard

Clarification of Question by craigangus-ga on 09 Oct 2004 06:00 PDT
OK little more detail, what I have so far is text drawing in a circle.
I do this by measuring the the circumference and then calculate the
arc distance of 1 degree

Carcd = circumference / 360f;

then I get the sweep angle of the length of text from

sweepAngle = textLength / Carcd;

I work out my start point and then draw each letter, work out the
arclength of a letter and so on till i have drawn the text.

The problem is that for an ellipse, Carcd is not consistant.

I need to work out the correct Carcd for length of text and how to get
the arclength for each letter so that the start postion would be so
that teh text is symetrical about the y axis
Answer  
Subject: Re: Calculating arc lengh on ellipse, calculating start and end points worked ex
Answered By: mathtalk-ga on 12 Oct 2004 05:34 PDT
 
Hi, craigangus-ga:

The application described (formatting a text string around the
perimeter of an "oval") raises some interesting issues that go beyond
that of finding the length of an elliptical arc.  In a circle
orienting the characters perpendicular to the circumference is
equivalent to aligning them parallel with a radial line.  Because an
ellipse is essentially a stretched circle, this perpendicularity is
not generally valid in the case of an ellipse (ie. placing the
characters perpendicular to the perimeter of the ellipse is not simply
a matter of drawing them aligned to a line from perimeter to the
center of the ellipse).

However if the height of characters is fairly small in relation to the
distance to the center of the ellipse, then the tilting of the
characters necessary to align them to the perimeter will not have a
big effect on the length of the display string.  The letters will of
course be "crowded" somewhat at the ends closer to the center than at
the ends furthest from the center.

We will be focused in this answer on your original problem of finding
the length of an elliptical arc and on the inverse problem of finding
an elliptical arc of a given length.

A general theory of arc length is outlined in the Comment posted
below.  We illustrate first the computation of length for an
elliptical arc using the example you suggested, of an ellipse
(centered at the origin, for simplicity) whose width is 36 units and
whose height is 25 units.

The equation of such an ellipse in "standard position" would then be:

    x²    y²
   --- + --- = 1
    A²    B²

with A = 18 and B = 12.5 (because A,B represent the half-lengths of
the axes of the ellipse).

Using the parameterization (t is in radians, but t is not a "central
angle" as explained in the Comment):

   x = A cos(t), y = B sin(t)

we will begin with computing the length of the entire ellipse, or
rather (because of symmetry) with computing the quarter of its length
that lies in the second quadrant, ie. where t ranges from pi/2 to pi.

Thus we have for this length an integral (explained below):

  INTEGRAL sqrt( (A sin(t))² + (B cos(t))² ) dt OVER [pi/2,pi]

The midpoint rule approximates this integral by the length of the
interval times the value of the integrand at the midpoint of the
interval:

  (pi - pi/2) * sqrt( (A sin(3pi/4))² + (B cos(3pi/4))² )

I set up rows in an Excel spreadsheet, using varying values of t
running down the first column and computing the lengths and midpoint
values (and their products) across the corresponding rows.  For the
single midpoint above, I get:

  1.570796 * 15.49597 = 24.34101

when rounded to the places shown.

To assess the accuracy of this value, I then computed using a
"composite" midpoint rule for three equal subintervals in the same
range.  That is, the interval [pi/2,pi] was broken into:

  [pi/2,2pi/3], [2pi/3,5pi/6], and [5pi/6,pi]

and the midpoint rule applied to each subinterval separately.  The
values for the three subintervals are then summed to get a total for
the overall range:

  9.259898 + 8.113669 + 6.776249 = 24.14982

The "refined" approximation to the integral (and thus to the length of
the elliptical arc) has changed only slightly.  Since the computer is
doing most of the work, with a bit of cut-and-paste on my part,
refining the subintervals once again by thirds produced the sum
24.14978 (using nine subintervals).

So the length of one quarter of the ellipse is pretty clearly
converged, at least as far as a computer graphic pixelization would
require.

Let's turn now to finding a pair of endpoints, symmetric with respect
to the y-axis, which give an arc of some prescribed length.  In the
Comment I suggested that we might want a string/arc of length 19.8 and
that by symmetry we would put half to the left and half to the right
of the y-axis.

Thus we would want to find T between pi/2 (the positive y-axis) and pi
such that the arclength over [pi/2,T] is 9.9.  As a starting point let
me give the approximate lengths for the nine subintervals from the
final tabulation above:

  [pi/2,5pi/9]       3.135409
  [5pi/9,11pi/18]    3.086633
  [11pi/18,2pi/3]    2.992814
  [2pi/3,13pi/18]    2.861552
  [13pi/18,7pi/9]    2.704556
  [7pi/9,5pi/6]      2.537868
  [5pi/6,8pi/9]      2.381663
  [8pi/9,17pi/18]    2.258750
  [17pi/18,pi]       2.190539

If we add up the "lengths" from the first three of these intervals, we
get 9.214855, which is a bit less than the 9.9 we want.  Therefore
some but not all of the "fourth" interval will have to be included. 
We have narrowed down T to between 2pi/3 and 13pi/18.

Splitting the interval [2pi/3,13pi/18] itself into three subintervals gives:

  [2pi/3,37pi/54]     0.969610
  [37pi/54,19pi/27]   0.953850
  [19pi/27,13pi/18]   0.937126

Because we only want to increment the arc's length by:

  9.9 - 9.214855 = 0.685145

the first of the three new subintervals is more than enough.  An
adequate approximation can now be obtained by taking T to be
proportional within that interval to the fraction 0.685145/0.969610 of
its length which we require.

  T = (2pi/3) + (pi/54)*(0.685145/0.969610)

which yields roughly T = 2.1355.

If more than about two decimal places of accuracy were required, we
could of course carry out a more refined computation.

Please let me know if some part of this discussion needs Clarification.

regards, mathtalk-ga
Comments  
Subject: Re: Calculating arc lengh on ellipse, calculating start and end points worked ex
From: mathtalk-ga on 10 Oct 2004 22:38 PDT
 
The length of an elliptical arc is surprisingly hard to compute, at
least in comparison to that of a circular arc.

To avoid "singularities" introduced by points of a curve where x or y
may fail to define a function, e.g. for the circle x² + y² = r², it's
often simplest to parameterize the curve.

Suppose x = x(t) and y = y(t) for some range of values t.  Calculus
gives us the general formula for arclength:

  s(t) = INTEGRAL Sqrt( x'(t)² + y'(t)² ) dt

[For the sake of brevity we will write definite integrals using an
indefinite integral notation, with the convention that the constant of
integration is determined so that the integral is zero "at" t = 0.]

The circle has a "uniform" parameterization:

  x(t) = r cos(t)
  y(t) = r sin(t)

where s(t) = rt and t may be considered as a central angle sweeping
from the positive x-axis counterclockwise around the circle.

The ellipse has a similar parameterization in that:

  x(t) = A cos(t)
  y(t) = B sin(t)

periodically generate all points on the ellipse centered at the origin:

    x²    y²
   --- + --- = 1
    A²    B²

as t ranges from 0 to 2pi.  Note however that t cannot be identified
with the corresponding central angles, and s(t) is no longer a simple
constant times t.

It is nonetheless possible to evaluate the resulting integral for arclength:

  s(t) = INTEGRAL Sqrt( (A sin(t))² + (B cos(t))² ) dt

in a variety of ways:

1) Analytically

Although no "simple" expression for this integral can be given in
terms of composition of elementary transcendental functions and usual
arithmetic operations, it is given readily in terms of the incomplete
elliptic integral of the second kind, implemented in Mathematica as
EllipticE[t,m]:

[Elliptic integral of the second kind - MathWorld]
http://mathworld.wolfram.com/EllipticIntegraloftheSecondKind.html

2) Interpolation

In a broad sense approximating the values through a tabulation or
using a pre-computed formula whose error is known to be small.

3) Numerical integration

The formula above is very smooth, so any good quadrature scheme succeeds.

4) Arithmetic-geometric mean

An algorithm discovered by Gauss for computing values of
hypergeometric functions, to which elliptic integrals are easily
related.

For the sake of a concrete example, let's suppose the ellipse is like
the one suggested by craigangus-ga.  To be 36 units wide means the
semi-major axis is:

  A = 18

and to be 25 units wide means the semi-minor axis is:

  B = 12.5

Perhaps the piece of text to be printed along (say) the upper rim of
the ellipse symmetrically about the y-axis is to have a length of 19.8
units.  Clearly the ellipse is wide enough (in this case) to allow
printing such a string, so we will not dwell (unless asked!) on
detecting when a string is so long that it begins to "wrap around".

The positive y-axis is where t = pi/2 on the parameterized ellipse. 
So we are asked to find t > pi/2 such that:

  s(t) - s(pi - t) = 19.8

or by symmetry:

  s(t) - s(pi/2)  =  9.9

This sort of problem is easily handled by the numerical integration
approach, as is suggested by this thread:

[Elliptical Arc Length - Ask Dr. Math]
http://mathforum.org/library/drmath/view/51945.html

Perhaps the simplest decent quadrature rule for such integrals is the
mid-point rule:

[Numerical integration]
http://www.damtp.cam.ac.uk/user/fdl/people/sd/lectures/nummeth98/integration.htm

It will suffice in any case for our illustration here, though a
"quality" canned routine might estimate the error of the midpoint rule
using a more accurate Simpson's rule approximation as a comparison.

An Excel spreadsheet can be used to provide such an illustration. 
I'll go off and set that up, then come back and (unless there are
objections) post the results as an Answer.

regards, mathtalk-ga
Subject: Re: Calculating arc lengh on ellipse, calculating start and end points worked exampl
From: craigangus-ga on 12 Oct 2004 00:39 PDT
 
An excel spreadsheet illustration would be excellent.

I dont think the results have to be too accurate. An approximation
would be best if it can be calcutlated easier.
Subject: Re: Calculating arc lengh on ellipse, calculating start and end points worked exampl
From: craigangus-ga on 14 Oct 2004 04:15 PDT
 
Answer looks good, but I'll need a bit of time to review, if I need
any clarification I will get back to you. Thanks

Important Disclaimer: Answers and comments provided on Google Answers are general information, and are not intended to substitute for informed professional medical, psychiatric, psychological, tax, legal, investment, accounting, or other professional advice. Google does not endorse, and expressly disclaims liability for any product, manufacturer, distributor, service or service provider mentioned or any opinion expressed in answers or comments. Please read carefully the Google Answers Terms of Service.

If you feel that you have found inappropriate content, please let us know by emailing us at answers-support@google.com with the question ID listed above. Thank you.
Search Google Answers for
Google Answers  


Google Home - Answers FAQ - Terms of Service - Privacy Policy