Home Jensen Archive jWiki Jensen News Jensen Cloud Jensen Programming Jensen Family Tree JensenDiary
This is the 3rd attempt to build a Solar System model following Newton's Universal Gravitation formula. It also calculates the center of masses of the system (baricenter) and displays it on a second window. The initial positions of the planets are accurate.

float lamdaTime= 1; //frames in a second
//float G = 6.6738e-11;
float G = 6e-11 ;//* 3e-12;
PGraphics globalTrag;
//1px = 5.000.000 km
float kmToPx = 4000000;
long yearCount = 0;
Particle[] particle = new Particle[9];
boolean newYear = false;
void settings(){
fullScreen(2);
}
void setup() {
randomSeed(0);
//size(1600, 800);
globalTrag = createGraphics(width,height);
globalTrag.beginDraw();
globalTrag.background(51);
globalTrag.endDraw();
...
If you have a problem with this code, you can contact me at gerardjensenolmo@gmail.com