Skip to content

Instantly share code, notes, and snippets.

@shiffman
Created December 9, 2013 03:24
Show Gist options
  • Save shiffman/7866961 to your computer and use it in GitHub Desktop.
Save shiffman/7866961 to your computer and use it in GitHub Desktop.
translate and scale to set origin at center and flip y-axis
void setup() {
size(400, 400);
}
void draw() {
background(0);
translate(width/2, height/2);
scale(1, -1);
stroke(255);
line(-200, 0, 200, 0);
line(0, -200, 0, 200);
// Draw point 100,50
fill(255);
ellipse(100, 50, 16, 16);
// Draw point -100,-150
fill(255);
ellipse(-100, -150, 16, 16);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment