Reverse engineer a list of primitive shape drawing instructions for the diagram below.

size(10,10);
stroke(0);
point(1,1);
line(1,5,1,9);
line(0,9,6,3);
rect(4,1,6,3);
ellipse(7,8,4,3);

Note: this exercise could probably be improved by having an ellipse in the bottom right with a more obvious center pixel.

  • jason

    Isn’t the ellipse supposed to be, ellipse(6,7,4,3)?

  • admin

    Default ellipse mode is “CENTER” meaning the registration point of the ellipse is the center. You are right thought, that CORNER mode would be more clear and so you could revise the answer to be:

    ellipseMode(CORNER);
    ellipse(6,7,4,3);
    
  • Dolsign

    Looking at line (0,9,6,3); I would of thought the answer to be line (0,9,5,4); as it’s not obvious that the line is attached to the square.

  • http://www.learningprocessing.com Daniel Shiffman

    Indeed, that is probably a better solution, either way is technically correct.

  • Sok Lin

    There is also possible to be,
    ellipse Mode (CORNERS);
    ellipse (6,7,9,9)

  • Mixolidia

    Shouldn’t the answer for the ellipse be “ellipse (6,7,4,3);”?

  • Anonymous

    That would be correct for ellipseMode(CORNER)

  • http://www.facebook.com/samuel.gambini Samuel Gambini

    ellipseMode(CORNERS) ellipse(6,7,9,9)

    That’s right?? 

  • Anonymous

    indeed!

  • Dallas

    According to Exercise 1-2, “ellipse(7,8,4,3);” = Processing approximates by generating a rectangular with width one pixel higher…

  • Bobaskins13333

    yes yes im cool right

  • Bob

    you fat

  • Robert

    yes I think that is right.

  • http://www.facebook.com/people/Min-Kyoung-Ka/1158676363 Min Kyoung Ka

    rect Mode (CORNER);
    rect (4,1,5,2);

    That’s right?

  • Anonymous

    indeed!