Earth to move in it's orbit

If you have an ellipse like this :

You have the coordinates of your smaller ellipse with this formula :

image

Example :

float t = 0;
int a = 150;
int b = 100;

void setup(){
  size(400,400);
}


void draw(){
  background(255);
  translate(width/2,height/2);
  
  noFill();
  ellipse(0,0,a*2,b*2);
  
  fill(0,0,255);
  ellipse(a*cos(t),b*sin(t),10,10);
  
  t += 0.01;
}

You can find further informations on : https://en.wikipedia.org/wiki/Ellipse

1 Like