Answer the question
In order to leave comments, you need to log in
How can I correctly move a point on Cartesian coordinates around a circle?
Hello, I don't understand how to move a point around a circle on Cartesian coordinates, I did it like this:
x = x*cos(a) - y*sin(a)
y = x*sin(a) + y*cos(a)
Answer the question
In order to leave comments, you need to log in
Just move the origin to the second point.
For reflection:
The origin is (0;0). Rotate it:
x = (x-0)*cos(a) - (y-0)*sin(a) + 0
y = (x-0)*sin(a) + (y-0)*cos(a) + 0
I did the rotation of the Moon around the Earth, simultaneously with the rotation of the Earth around the Sun, so I'll give you a hint.
Here is the rotation of the moon relative to the earth. Understand, like everything should be clear.
xx and yy - coordinates of the moon
// TrackBar1->Position — скорость вращения. Не обращайте внимания. Можете поставить 1.
xx = xx * cos(M_PI / 31.05819323 * TrackBar1->Position) + yy * sin(M_PI / 31.05819323 * TrackBar1->Position);
yy = -xx * sin(M_PI / 31.05819323 * TrackBar1->Position) + yy * cos(M_PI / 31.05819323 * TrackBar1->Position);
Image1->Canvas->Pen->Color = clGray;
Image1->Canvas->Brush->Color = clGray;
Image1->Canvas->Ellipse(
width_window / 2 - earth_xx - xx - radius_moon,
height_window / 2 - earth_yy - yy - radius_moon,
width_window / 2 - earth_xx - xx + radius_moon,
height_window / 2 - earth_yy - yy + radius_moon
);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question