# Creating a parametrized ellipse at an angle

I'm creating a computer program where I need to calculate the parametrized circumference of an ellipse, like this:

x = r1 * cos(t), y = r2 * sin(t)


Now, say I want this parametrized ellipse to be tilted at an arbitrary angle. How do I go about this? Any obvious simplifications for i.e 30, 45 or 60 degrees?

-

If you want to rotate $\theta$ radians, you should use $$t\mapsto \left( \begin{array}{c} a \cos (t) \cos (\theta )-b \sin (t) \sin (\theta ) \\ a \cos (t) \sin (\theta )+b \sin (t) \cos (\theta ) \end{array} \right)$$

-

If you rotate $(x=r_1\cos t,y=r_2\sin t)$ by $\theta$ about $(0,0)$, the resulting curve is given by $(x'=r_1\cos t\cos\theta-r_2\sin t\sin\theta, y'=r_1\cos t\sin\theta+r_2\sin t\cos\theta)$.

(Using the fact that complex multiplication by $e^{i\theta}$ rotates by $\theta$ about $0$, the point $(x,y)=x+yi$ is mapped to $(x+iy)(\cos\theta+i\sin\theta)=$ $x\cos\theta-y\sin\theta+i(x\sin\theta+y\cos\theta)=$ $(x\cos\theta-y\sin\theta,x\sin\theta+y\cos\theta)$.)

-
Thanks! I'll try this out in code tomorrow. –  Pedery Jan 14 '11 at 7:28

Update:

Given

$x = r_1 \cos(t)$, $y = r_2 \sin(t)$

using the equation of ellipse in polar form we have : (could someone confirm this please?)

$r(\theta) = \frac {r_1r_2}{\sqrt {{r_1^2 \sin^2 (\theta)}+{r_2^2 \cos^2 (\theta)}}}$

to rotate by angle $\phi$ :

$r(\theta) = \frac {r_1r_2}{\sqrt {{r_1^2 \sin^2 (\theta-\phi)}+{r_2^2 \cos^2 (\theta-\phi)}}}$

The original incorrect answer is below:

$x = r_1 \cos(t + \phi)$, $y = r_2 \sin(t + \phi) \text {, where }\phi$ is your angle of tilt in radians

This was as pointed out was my mistake on thinking polar while working with parametric. I have tried converting this to polar form but adding angle of $\phi$ and reverting back to parametric form so far has not been possible.

Has anyone seen solution of this problem by converting to polar coordinates and performing an angle addition and converting back to parametric form?

-
I'm pretty sure that just changes the parameterization (which points correspond with which values of the parameter), not the orientation of the resulting curve. –  Isaac Jan 14 '11 at 7:22
Yep, Isaac is correct. it would produce the same looking ellipse since t is in the interval [0, 360], regardless of whether a constant is added. Your answer would simply start and end the ellipse at a different place along the curve. –  Pedery Jan 14 '11 at 7:25
@Arjang: the problem is that they aren't occurring "at" $\frac{\pi}{2}$ or $0$ in the sense of polar location; they are occurring "at" those values in the sense of, for instance, time. The points are still in the same places. –  Isaac Jan 14 '11 at 7:30
@Arjang: compare this original, this by your formula, and this by my formula –  Isaac Jan 14 '11 at 7:34
@Arjang: It looks like it works, but I think you want $\theta-\phi$ instead of $\theta+\phi$. –  Isaac Jan 24 '11 at 1:55