Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / Planet orbit around the sun

Author
Message
Madehra
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: Portugal
Posted: 10th Jun 2003 00:23
Whats the best way to do it? Vector?
Could someone make a quick example of a code that orbits a sphere around the center? Pelease?
Easily Confused
21
Years of Service
User Offline
Joined: 22nd Oct 2002
Location: U.K. Earth. (turn right at Venus)
Posted: 10th Jun 2003 07:30 Edited at: 10th Jun 2003 07:32
There are a couple of ways to do this:

The NewXvalue() and NewZvalue() way:


...or the sin() and cos() way:



Hope this helps

Programming anything is an art, and you can't rush art.
Unless your name is Bob Ross, then you can do it in thirty minutes.
Madehra
22
Years of Service
User Offline
Joined: 19th Sep 2002
Location: Portugal
Posted: 10th Jun 2003 18:08
Very nice! Many thanks Easily Confused!
Not only did you show me two ways to do this, you also helped me to better understand the newx/y/zvalue commands!

Also, appologies to the moderator(s), this should have gone to the newbies forum. Anyway, two very usefull snippets to those of us learning
BuzzBob
21
Years of Service
User Offline
Joined: 12th Apr 2003
Location:
Posted: 19th Jun 2003 00:06
But planets don't travel round stars in a perfectly circular orbit! They go in ellipses due to gravity which takes alot more complicated code. I might put it in the main page later but for an example of it's use look at my "Gravity simulator" in the 20 lines of code competition forum.

Login to post a reply

Server time is: 2024-09-20 11:44:54
Your offset time is: 2024-09-20 11:44:54