Given a point P
on a 'canonical' ellipse defined by axes a, b
, and an arc length s
, how can I find a point Q
, also on the ellipse, that is s
clockwise along the elliptical curve from P
— such that if I were to start at P
and 'walk along' the elliptical curve for a distance of s
, I would reach Q
— programatically and without breaking the computational bank?
I have heard that this can be computed through some sort of elliptical integration, but I need to do this a bunch, and quickly. What I'm looking for is an easy to use, computationally inexpensive, and fairly accurate approximation method. Or at least a method that is one or two of those things. I will be implementing this in python.
Edit: alternatively,开发者_开发知识库 I might be forced to create a lookup table of position values around ellipses (I might only need in the 10s of dissimilar ellipses). How should I do this, and what method can I use to fill it?
You'll need to integrate the ellipse equation. It's not difficult, actually.
Take a look at the equations here:
Link
Since you're using python, the Runge-Kutta for integration is implemented in Python here (I don't know the license, though):
http://doswa.com/blog/2009/04/21/improved-rk4-implementation/
Just on step 3 and 4 of mathforum solution you already have a value for ds (the arc lenght) and you want dx.
After finding dx, use step 6 to find y.
You could use scipy.special.ellipeinc to calculate the arclengths. (More details are given by Roger Stafford here.)
If that isn't fast enough, you could wrap the arclength calculation in a function and use a memoize decorator to cache the result of previous (arclength) function calls.
Or, as you've mentioned, you could pre-calculate the values you need, and store them in a dict.
In order to solve the problems you need a conjeture:there is a circle in unit elipse
a=1, that it has the same perimeter han the elipse. That perim is 2πrp.your. perimeter is then P=2πrp x a
精彩评论