# Calculating a Point that lies on an Ellipse given an Angle

I need to find a point (A on this diagram) given the center point of the ellipse as well as an angle. I've been melting my brain all day (as well as searching through questions here) testing out different equations. What's the best way to do this?

I intend to grab point A at $225^o$ as well as another point at approximately $250^o$ using the same math. These need to be fetched regardless of elliptic width and height.

If the ellipse is centered at the origin, the equation of the ellipse is $\frac{x^2}{a^2}+\frac{y^2}{b^2}=1$. The equation of the line is $y=x\tan \theta$ So you have $\frac{x^2}{a^2}+\frac{(x\tan \theta )^2}{b^2}=1$ or $x=\pm \frac{ab}{\sqrt{b^2+a^2(\tan \theta)^2}}$ where the sign is + if $-\pi/2 \lt \theta \lt \pi/2$

• Well, this is embarrassing. The code I was working with already fetches the exact same value this does. I was sure my math was wrong. It looks like I'll have to figure out how to handle this data in Flash given its wonky co-ordinate system. Regardless, thanks for the quick answer.
– null
Commented Feb 14, 2011 at 23:53
• Similarly for y: $y=\pm \frac{ab}{\sqrt{a^2+\frac{b^2}{(\tan \theta)^2}}}$ Commented Jul 25, 2014 at 0:25
• @CharlesL. : why would you get y like that instead of simply $y=\sqrt{ 1-(x/a)^2 } * b$ if you have x already?
– B M
Commented Oct 16, 2015 at 14:17
• BM Does not work for all angle. @CharlesL. But the sign condition is different, isn't it? Commented Oct 28, 2016 at 18:53
• Ross' + Charles' formulas for x and y respectively are the correct ones, the other ones in this thread didn't work for me (though maybe I was doing smth wrong, dunno). Commented Dec 9, 2023 at 11:10

You can also use parametric equations:

$$x=a\cos(\theta)$$ $$y=b\sin(\theta)$$

Where $a$ is the radius on the horizontal axis, and $b$ is the radius on the vertical axis.

• In this parametrization, $\theta$ is not the angle of the post, for example for $\theta=225$ of the diagram the corresponding point on the ellipse is not given by your formulas. Commented May 19, 2013 at 17:28
• @coffeemath Why wouldn't $x = a\cos(225°)$ and $y=b\sin(225°)$ work? Commented May 19, 2013 at 17:33
• @Zettasurro -- those equations will give you a point on the ellipse. But the polar angle of this point will not be 225 degrees. Commented May 19, 2013 at 23:28
• Look again at the problem posted. The angle 225 marked in the diagram is the angle centered at the ellipse center (midpoin of foci) with initial side the positive $x$ axis and terminal side as marked, and is to be 225 degrees. In general if $(x,y)$ is on the terminal side of such an angle, one has $\tan \theta=y/x$. But with your point $(x,y)=(a \cos 225, b \sin 225)$ you get $y/x=(b/a)\tan 225$ which is not $\tan 225$ unles $a=b.$ Commented May 20, 2013 at 12:47
• @fguillen I’m guessing you did not actually need the exact angle you specified. This gives a symmetrical mapping onto the ellipse so it looks a lot like it is working. So how do we check the angle? The point (cos(θ), sin(θ)) gives the angle we want, as does any point which scales them equivalently. That’s how you know you’re on the line for θ. One of those points gives the intersection we want. But this approach scales them differently, so how can it be on the same line? As you go around this way you’ll find some areas are more compressed or stretched than others. Commented Jun 29, 2023 at 5:04

If the ellipse is centered at $(0,0)$, $2a$ wide in the $x$-direction, $2b$ tall in the $y$-direction, and the angle you want is $\theta$ from the positive $x$-axis, the coordinates of the point of intersection are $$\left(\frac{a b}{\sqrt{b^2+a^2\tan^2(\theta)}},\frac{a b \tan(\theta)}{\sqrt{b^2 + a^2\tan^2(\theta)}}\right) \text{ if }0\le\theta< 90°\text{ or }270°<\theta\le360°$$ or $$\left(-\frac{a b}{\sqrt{b^2+a^2\tan^2(\theta)}},-\frac{a b \tan(\theta)}{\sqrt{b^2 + a^2\tan^2(\theta)}}\right) \text{ if }90°<\theta< 270°.$$

• Doesn't $\tan$ become negative for $\theta \gt 90^{\circ}$ so the signs are flipped over $90^{\circ}$ to $270^{\circ}$ Commented Feb 14, 2011 at 23:36
• @Ross: I think I've got the signs and ranges right now (perhaps you were looking at my initial post with incorrect ranges). For example, between 90° and 180°, using the second formula and tangent is negative, the $x$-coordinate is negative and the $y$ coordinate is positive (opposite of the negative tangent), which is correct for angles between 90° and 180°. Commented Feb 14, 2011 at 23:43
• Looks good to me Commented Feb 15, 2011 at 1:20
• I think there's a small error here still. Where it says "90° < θ < 270°" it should be "90° < θ <= 270°".
– Tony
Commented Feb 9, 2018 at 22:27
• @Tony I think 90° and 270° are excluded because $\tan\theta$ would be undefined. Commented Feb 10, 2018 at 19:37

I've been working on this one for a while now because I was trying to test a coordinate for overlap with an ellipse, and I came up with something much easier to find the point on an ellipse given an angle from the center. If you use a general first degree equation for the line and substitute into the equation for an ellipse then you can solve for x and y (the points where the line intercepts the ellipse).

To find the general first degree equation of a line, you can use this formula : $$(y_1 - y_2)*x + (x_2 - x_1)*y + (x_1*y_2 - x_2*y_1) = 0$$

Since the ellipse is centered on the origin and the line passes through it as well, you can simplify the equation for the line by substituting $x_1 = 0$ and $y_1 = 0$ and you come up with : $$-y_2*x + x_2*y = 0$$

Solve for x and y and you get $$x = \frac{x_2*y}{y_2} , y = \frac{y_2*x}{x_2}$$

Next use the equation for an ellipse $$\frac{x^2}{a^2} + \frac{y^2}{b^2} = 1$$ and substitute in x and y and solve for $y^2$ and $x^2$ respectively. You come up with these two equations : $$y^2 = \frac{a^2*b^2*y_2^2}{(b^2*x_2^2 + a^2*y_2^2)} , x^2 = \frac{a^2*b^2*x_2^2}{b^2*x_2^2 + a^2*y_2^2}$$ If you know the point on the line you can substitute in $x_2$ and $y_2$, but since all we have is an angle, we'll have to re-derive our line equation. It's not hard though. To find the x and y coordinates of a point using a radius (which we won't need) and an angle, you just use a little trigonometry. The x value of the triangle is $r*\cos{\theta}$ and the y value is $r*\sin{\theta}$. Substitute these in for $x_2$ and $y_2$ above and you get $-r\sin{\theta}*x + r\cos{\theta}*y = 0$. Notice you can divide by the radius now to remove it from the equation, leaving us with $-\sin{\theta}*x + \cos{\theta}*y = 0$. Re-substitute into the earlier equation and you get $y = \sin{\theta}$ and $x = \cos{\theta}$. Substitute these into the equations for $y^2$ and $x^2$ and you come up with the following equations. $$y = \pm\frac{ab\sin{\theta}}{\sqrt{(b\cos{\theta})^2 + (a\sin{\theta})^2}} , x = \pm\frac{ab\cos{\theta}}{\sqrt{(b\cos{\theta})^2 + (a\sin{\theta})^2}}$$

You now know another formula to find the coordinates of a point on an ellipse given only an angle from the center, or to determine whether a point is inside an ellipse or not by comparing radii. ;)

The equation of an ellipse in its origin centered form is:

$(\frac{cos \theta} {a})^2 + (\frac{sin \theta} {b})^2=(\frac{1}{ r})^2$.

Hope you take it from there.

I think there might be an alternative that doesn't need to define a piecewise function and we don't have problems in handling some angles:

$$x(\theta) = r(\theta)cos(\theta)$$
$$y(\theta) =r(\theta)sin(\theta)$$

where $$r(\theta)$$ is the radius of the ellipse given $$\theta$$ and is given by $$r(\theta)=\frac{ab}{\sqrt{a^2sin^2(\theta)+b^2cos^2(\theta)}}$$, see here.

N.B.: This works as well for an ellipse tilded by an angle of $$\phi$$ and the parametrisation is

$$\begin{bmatrix}x(\theta)\\y(\theta)\end{bmatrix} = \begin{bmatrix}cos(\phi)&-sin(\phi)\\sin(\phi)&cos(\phi)\end{bmatrix}\begin{bmatrix}r(\theta-\phi)cos(\theta-\phi)\\r(\theta-\phi)sin(\theta-\phi)\end{bmatrix}$$