should be…
ellipse (3,7,5,5);
based upon figure 1.10 in book.
Yes? No?
Pete
rect (5,0,4,3);
should be…
rect (5,0,5,4);
based upon figure 1.7 in book.
Yes? No?
admin
Yes, technically you are correct. However, it is physically impossible to have an ellipse with a perfect center at (3,7) with an “even” width. So Processing approximates. I didn’t mean for this to be a trick question, however, and it’s really an oversight on my part. The exercise would be a lot clearer with (3,7,5,5). Nevertheless, the above result is exactly how Processing would do it (the answer was generated with Processing itself!).
admin
Re: rect(5,0,4,3). This is another excellent point. Really, you are correct. I’m not sure why Processing generated the rectangle one pixel higher. Most likely, this is due to the fact the Processing puts the outline of a shape on the outside pixel (i.e. the interior width is 4, so the line falls on the 5th pixel). This is mostly an artifact of looking at this shapes zoomed in.
Lun Chanmaranden
sum=0
for(i=1;i<=n;i++)
sum=sum+i;
Natalie
For rectify(5,0,4,3) in corners mode, wouldn’t (4,3) as the supposed “bottom right corner” produce an error since it is to the left of the top left corner (5,0)? I don’t understand the diagrammed rectangle in the answer but am I just completely missing something?
Natalie
Whoops autocorrect I meant rect not rectify
Natalie
Just realized there’s a difference between rect(CORNER) and rect(CORNERS) so disregard previous questions…. However the rectangle in the answer seems to be rect(5,0,5,4) – 1 pixel larger on each side?
Anonymous
Yes, technically, you are correct. I’m not sure why Processing generated the rectangle one pixel higher. Most likely, this is due to the fact the Processing puts the outline of a shape on the outside pixel (i.e. the interior width is 4, so the line falls on the 5th pixel). This is mostly an artifact of looking at this shapes zoomed in.
jsmalo
Yes, I have start to read it again, the book and is the 3rd time I have been thinking on how is the right way to do it on paper jejejeje
Goma
Based on the answers it is ellipse (4,8,5,5) why in te book the exercise is ellipse (3,7,4,4)
shiffman
yes, 5 is probably more accurate. if it’s four pixels wide, there is no perfect center pixel so sometimes processing might round, etc. you never really draw anything this small so it doesn’t come up that much. this exercise just gets at the general idea of cartesian pixel coordaintes.
shiffman
0,0 is the top left, not 1,1. see above response for more.