Given the equation of an ellipse and two points on the ellipse, how would you find the length of the arc in between the two points?

I'm only in pre-cal math right now and I've been told that this problem requires calculus. I likely wouldn't understand any calculus explanations so pseudocode might help.

Thanks in advance.

## Arc of an ellipse

**Moderators:** gmalivuk, Moderators General, Prelates

- Torn Apart By Dingos
**Posts:**817**Joined:**Thu Aug 03, 2006 2:27 am UTC

### Re: Arc of an ellipse

There isn't a nice, neat formula for the arc length. Wikipedia gives the formula for it in terms of the elliptic integral, which basically is saying it's equal to itself. Some approximations are listed though.

If you want to find it with code, you can simply connect some points on the arc together with straight line segments and add together their total lengths. The more points you use, the better the result.

If you want to find it with code, you can simply connect some points on the arc together with straight line segments and add together their total lengths. The more points you use, the better the result.

### Re: Arc of an ellipse

What if I have a point and an arc length? How do I get the second point from that?

meow

- Torn Apart By Dingos
**Posts:**817**Joined:**Thu Aug 03, 2006 2:27 am UTC

### Re: Arc of an ellipse

There's no explicit formula for that either. If you want to approximate it, start at the point and walk tiny straight line steps along the curve until you've walked the given arc length.

### Re: Arc of an ellipse

howardh wrote:What if I have a point and an arc length? How do I get the second point from that?

Have you considered praying for divine inspiration? I've heard it works sometimes, even if you don't believe in that sort of thing.

Seriously, this is an even tougher problem to solve. Although, if you already have an accurate method of finding arclength, you could just calculate the arclength from your given point to a couple other points, and then interpolate to find your next guess, etc. But this could only be roughly as accurate as the arclength-finding method.

Alternately, make a pencil that can consistently draw a line of constant width and thickness, but which only has enough graphite in it to draw exactly the arclength you're looking for. Then stick two thumbtacks into the foci of the ellipse, and connect them with a string the length of the major axis of the ellipse, and use the taut string as a guide for the pencil as you trace out the desired arclength from the chosen point.

- J Spade
- Luppoewagan
**Posts:**523**Joined:**Wed Apr 18, 2007 7:56 pm UTC**Location:**Up a creek without a paddle-
**Contact:**

### Re: Arc of an ellipse

Or use the string, cut to be the desired arc length.

- gmalivuk
- GNU Terry Pratchett
**Posts:**26834**Joined:**Wed Feb 28, 2007 6:02 pm UTC**Location:**Here and There-
**Contact:**

### Re: Arc of an ellipse

But then you have to very carefully lay the string on the ellipse to make sure you've got that length.

### Re: Arc of an ellipse

J Spade wrote:Or use the string, cut to be the desired arc length.

It'll probably help if I told you what I needed this for. I'm trying to create a simulation of the Earth's and Apophis' orbit so a string wouldn't be of much help.

Torn Apart By Dingos wrote:There's no explicit formula for that either. If you want to approximate it, start at the point and walk tiny straight line steps along the curve until you've walked the given arc length.

This seems to be the best (only) method so far.

Here's what I've worked out for getting the arc length:

Code: Select all

`foo(depth, p1,p2)`

point p1, p2 //points to test

double a, b, h, k //parameters of the ellipse equation

if depth == 0, return dist between p1 and p2

angle1 = atan((p1.y-k)/(p1.x-h))

angle2 = atan((p2.y-k)/(p2.x-h))

angle3 = (angle1+angle2)/2

point p3

p3.x = cos(angle3)*a+h

p3.y = sin(angle3)*b+k

return foo(depth-1,p1,p3) + foo(depth-1,p3,p2)

meow

### Re: Arc of an ellipse

What exactly do you want to achieve with this simulation? If you just want to see the orbits, there are several of implementations of orbit simulation freely available on the internet.

For writing a implementation, that gives realistic results in a reasonable amount of time, you would have to use some rather advanced methods (If you're particularly interested, I'd suggest an embedded Runge-Kutta pair), if you don't know calculus yet (and even if you do), going there might not be trivial.

But what you have to realize is that this is a physical simulation, and I don't think you actually need the arc length of the ellipses as such. The system can be described differentially. If you just use Newton's gravitational law and Euler's method, and plug in the initial positions and velocities of Earth and Apophis, you'd get an implementation that works. It might require a large amount of calculations to get the required accuracy (more than if you use more advanced methods), but I think it is the simplest approach to this.

For writing a implementation, that gives realistic results in a reasonable amount of time, you would have to use some rather advanced methods (If you're particularly interested, I'd suggest an embedded Runge-Kutta pair), if you don't know calculus yet (and even if you do), going there might not be trivial.

But what you have to realize is that this is a physical simulation, and I don't think you actually need the arc length of the ellipses as such. The system can be described differentially. If you just use Newton's gravitational law and Euler's method, and plug in the initial positions and velocities of Earth and Apophis, you'd get an implementation that works. It might require a large amount of calculations to get the required accuracy (more than if you use more advanced methods), but I think it is the simplest approach to this.

- Zamfir
- I built a novelty castle, the irony was lost on some.
**Posts:**7605**Joined:**Wed Aug 27, 2008 2:43 pm UTC**Location:**Nederland

### Re: Arc of an ellipse

There are approximate solutions for the circumference of an ellipse that work quite well. Search for "ramanujan ellipse".

### Re: Arc of an ellipse

GBog wrote:What exactly do you want to achieve with this simulation? If you just want to see the orbits, there are several of implementations of orbit simulation freely available on the internet.

To create a simulation that can determine when a probe can be launched from here to Apophis with the shortest distance.

GBog wrote:For writing a implementation, that gives realistic results in a reasonable amount of time, you would have to use some rather advanced methods (If you're particularly interested, I'd suggest an embedded Runge-Kutta pair), if you don't know calculus yet (and even if you do), going there might not be trivial.

But what you have to realize is that this is a physical simulation, and I don't think you actually need the arc length of the ellipses as such. The system can be described differentially. If you just use Newton's gravitational law and Euler's method, and plug in the initial positions and velocities of Earth and Apophis, you'd get an implementation that works. It might require a large amount of calculations to get the required accuracy (more than if you use more advanced methods), but I think it is the simplest approach to this.

Alright, I'll look into this.

meow

### Who is online

Users browsing this forum: No registered users and 14 guests