How to get all the points in an ellipse when I know a point of it and it's center?
I have the following situation:
I know the position of the red dot relative to the center, I have the vertical distance and the horizontal distance values. What I need is to calculate all the other possible points in the ellipse, as to know what other points the dot can be if it orbits the ellipse.
I have a coordinate system to make that
How is it possible to be done?
@EDIT
I'm also able to know the major axis and the minor axis
Best Answer
Let $a,b$ be the major and minor axes of the ellipse.
Let $x_0,y_0$ be the coordinates of the center on the ellipse.
Let $x_1,y_1$ be the coordinates of the one point on the ellipse.
First, we write the equation of the ellipse, those major axis is parallel to the $x$ axis of the coordinate system (which is at this point completely arbitrary).
$$\frac{(x-x_0)^2}{a^2}+\frac{(y-y_0)^2}{b^2}=1$$
Now we need the ellipse to go through the point $x_1,y_1$. This requires first that the distance between this point and the center is somewhere between $a$ and $b$:
$$b \leq \sqrt{(x_1-x_0)^2+(y_1-y_0)^2} \leq a$$
If it's indeed true, we need to find the four corresponding points on the ellipse on the same distance from the center.
$$d=\sqrt{(x_1-x_0)^2+(y_1-y_0)^2}$$
One of them is a green point on the picture below:
We need to find the green point. Let's call it $x_2,y_2$. Then we have two equations in two variables:
After you solve this simple system of equations and find $x_2,y_2$, there is one last step left: you need to rotate your ellipse.
First, find the angle between lines going from the center of the ellipse to $x_1,y_1$ and to $x_2,y_2$. You can do it by using vector dot product:
The rotated coordinates can be then found from the following system of equations:
$$x=X \cos \theta-Y \sin \theta \\ y=X \sin \theta+ Y \cos \theta$$
Note, that I inverted the problem - as if the ellipse is already rotated counter-clockwise, and we want to rotate it back. Meaning, we just substitute these formulas in the original equation:
And here is the equation for your ellipse. You still need to find $x_2,y_2$ and $\cos \theta$ - I leave it to you.
See http://en.wikipedia.org/wiki/Rotation_matrix for more about rotation.
Note, that there is four possible green points you can choose, so there is four different equations you might need to check, not two.