+ 5
How to rotate the moon around the earth on JAVA
I was creating a simple Solar System. The earth rotates around the sun. Now I am struggling while trying to rotate the moon around earth, in the same time while earth rotates around sun. Thank you for your help!
8 Respostas
+ 4
It can be called a circles superimposition implemented like here:
https://code.sololearn.com/WYEQcTXBZbeK/?ref=app
+ 2
Would be easier if you show your code, but maybe this helps:
I guess you're defining rotation in polar coordinates, i.e. increase angle by a fixed amount in each step, and then transferring to cartesian. So for the moon you can do the same, with an increase roughly 13 times that of the earth. That will represent the rotation moon around earth. Then transfer to cartesian and add those coordinates to the coordinates of the earth
+ 2
Do the rotation relative to the earth's frame of reference.
+ 1
Mirielle well girl thank you so much, a great solution😍 also sorry for taking your time❤️
- 4
ajaysingh