3

What's the parametric equation for the general form of an ellipse rotated by any amount?

Preferably, as a computer scientist, how can this equation be derived from the three variables: coordinate of the center/two foci and eccentricity of an ellipse?

I need to generate completely random eclipses within certain bounds. The variables I described above are most convenient. This is for a personal project of mine and I can't find anybody who can help me.

legends2k
  • 261
  • 4
  • 14

2 Answers2

6

Let's start with the parametric equation for a circle centered at the origin with radius 1:

x(t) = cos 2πt

y(t) = sin 2πt

To turn this into an ellipse, we multiply it by a scaling matrix of the form

| a  0 |
| 0  b |

which gives

| a  0 |   | x(t) |   | a x(t) |
| 0  b | * | y(t) | = | b y(t) |

To rotate this by θ degrees, multiply it by the rotation matrix

| cos θ   -sin θ |   | a x(t) |    |a x(t) cos θ - b y(t) sin θ|
| sin θ    cos θ | * | b y(t) | =  |a x(t) sin θ + b y(t) cos θ|

So the new parametric equation would be

x'(t) = a x(t) cos θ - b y(t) sin θ = a cos 2πt cos θ - b sin 2πt sin θ

y'(t) = a x(t) sin θ + b y(t) sin θ = a cos 2πt sin θ + b sin 2πt cos θ

You can then translate this to have center (x0, y0) by adding these components to the parametric components.

Hope this helps!

  • Oh, I see. What input to the equation controls the coordinates of the center of two foci, and the eccentricity of the ellipse? A bunch of grad students couldn't figure it out. Thanks. – augbar94 Sep 19 '14 at 02:20
  • You voted to close the question as off-topic but still answered it. You're just encouraging off-topic questions. –  Sep 19 '14 at 11:50
  • 1
    @HighPerformanceMark I was answering the question with the intent that it would then get migrates to the math site. My intent was to help the OP out, but also suggest a better site for questions like this in the future. I was under the impression that this was considered appropriate, and I'm sorry if this wasn't the right approach. – templatetypedef Sep 19 '14 at 15:19
  • I can't understand where is the final solution??? What are the parametric equations of X and Y given center of the Ellipse (X, Y), given both radiuses (major and minor), The angle of rotation (theta) and the angle between the center of the ellipse to the point X, Y on the ellipse (angle alfa)??? – Gil Epshtain Feb 11 '18 at 09:44
-1

If you have the coordinates (Cx,Cy) of the centre, the coordinates (Fx,Fy) of one of the foci, and the eccentricity e then the parametric equation of the ellipse are

 P(t) = C + cos(t)*A + sin(t)*B

where t is an angle going from 0 to 2*pi, A is the semi-major axis (vector) and B the semi-minor axis; A and B can be calculated like this:

c = hypot( Fx-Cx, Fy-Cy) /* distance from centre to focus */
a = c/e                  /* length of semi-major axis */
b = a*sqrt(1-e*e)        /* length of semi-minor axis */
(Ax,Ay) = (a/c)*(Fx-Cx,Fy-Cy)
(Bx,By) = (b/c)*(Fy-Cy, -(Fx-Cx))

Note that these equations will fail if e=0; but in that case the focus and the centre will be the same and you haven't specified the ellipse (circle) fully as the radius is unknown.

dmuir
  • 101