Tracing nested coordinate frames

A Processing Java-mode sketch uses nested coordinate transformations to place two joint markers:


Java
void setup() {
  size(420, 300);
  noStroke();
  ellipseMode(CENTER);

  pushMatrix();
  translate(200, 120);
  rotate(HALF_PI);

  pushMatrix();
  translate(50, 0);
  ellipse(0, 0, 12, 12);   // marker A
  popMatrix();

  ellipse(30, 0, 12, 12);  // marker B
  popMatrix();
}


Using Processing's default 2D screen coordinates, what are the screen coordinates of the centres of markers A and B? All coordinates below are in pixels.


Default screen axes show x increasing rightward and y increasing downward.


Choose an answer

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Processing Language Programming Questions: