Ellipse not correctly rotating using the general equation of ellipse

227 Views Asked by At

I have generated a set of y coordinates for a given set of x coordinates using the following generalized equation of ellipse:

$$\dfrac {((x-h)\cos(A)+(y-k)\sin(A))^2}{(a^2)}+\dfrac{((x-h) \sin(A)-(y-k) \cos(A))^2}{(b^2)}=1$$

This is the quadratic form of the equation given above: $$y^2(\dfrac{sin^2(A)}{b^2} + \dfrac{cos^2(A)}{a^2}) + y(2xsin(A)cos(A)(\dfrac {1}{a^2} - \dfrac {1}{b^2})) + (x^2(\dfrac{cos^2(A)}{b^2}+\dfrac{sin^2(A)}{a^2}) - 1)$$

The equation is in quadratic form: $$y^2Q + yW + C$$

I have managed to simplify the equation down to a quadratic form so that i can solve the equation, but i'm not able to rotate the ellipse by using values other than 0(zero) for A (which is the angle).

Ellipse with A = 0:

ellipse 1

Ellipse with A = 1:

enter image description here

Ellipse with A = 10:

ellipse 2

As you can see, the ellipse is not being constructed correctly for angles other than 0. What am i doing wrong? I'm using python to construct the ellipse.

PS: Let the set of x coordinate points be [1, 10].

1

There are 1 best solutions below

0
On BEST ANSWER

Suggestion: Instead of the implicit form, you might want to use the parameterized form of a circle $t \mapsto (\cos t, \sin t)$, $0 \le t \le 2\pi$, and transform it by scaling (to make it elliptical), rotating (to put the axes in the direction you want) and then translating (to move it to the location you want).