Planets

placeholder image 3 placeholder image 3 placeholder image 3 placeholder image 4 placeholder image 3 placeholder image 2 placeholder image 3 placeholder image 3 placeholder image 2

Planet-like drawing generated with a simple trigonometric trick. Just play with the values of num1 and num2 to generate drastically different drawings. Have a look at the simplified Processing code below or get the project on GitHub.

// change these 2 values below
float num1 = PI/80; // first angle
float num2 = PI/37; // second angle
int radius = 300; // radius of the circle
float angle1, angle2;
PVector p1, p2;
int i = 0; // counter

void setup() {
  strokeWeight(0.8);
  background(0);
  stroke(255);
}

void draw () {
  translate(width/2, height/2);
  angle1 = i*num1;
  angle2 = i*num2;
  p1 = new PVector (pow(cos(angle1), 1) * radius, pow(sin(angle1), 1) * radius);
  p2 = new PVector (pow(cos(angle2), 1) * radius, pow(sin(angle2), 1) * radius);
  line(p1.x, p1.y, p2.x, p2.y);
  i++;
}