//Initalize variables float G, M; /* where:- G is the gravitational force constant M is the mass of the planet */ float r, Theta, Omega, v; void setup(){ size(800,600); frameRate(60); G = 6.67*pow(10,-11); M = 18*pow(10,17); Theta = 0; } void draw(){ background(0); r=(dist(width/2,height/2,mouseX,mouseY)); pushMatrix(); translate(width/2,height/2); //draw planet stroke(0); fill(0,255,0); ellipse(0,0,80,80); //draw moon v = sqrt((G*M)/r); Omega = v/sqrt(pow(r,2)); Theta += Omega/frameRate; stroke(0); fill(0,255,0); ellipse(r*cos(Theta),r*sin(Theta),20,20); popMatrix(); }