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!).
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.
ellipse (3,7,4,4);
should be…
ellipse (3,7,5,5);
based upon figure 1.10 in book.
Yes? No?
Comment by Pete — September 19, 2008 @ 8:02 pm
rect (5,0,4,3);
should be…
rect (5,0,5,4);
based upon figure 1.7 in book.
Yes? No?
Comment by Pete — September 19, 2008 @ 8:07 pm
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!).
Comment by admin — September 19, 2008 @ 8:11 pm
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.
Comment by admin — September 19, 2008 @ 8:13 pm