On Wed, May 20, 2009 at 5:45 PM, Shawn Erickson <shaw...@gmail.com> wrote: > On Wed, May 20, 2009 at 1:00 PM, John Harper <j...@apple.com> wrote: >> CGRectZero is the rectangle at point (0, 0) with zero size. For an empty >> rectangle that will work correctly with CGRectUnion you need to use >> CGRectNull instead. > > I guess the docs need to be corrected then since the following implies > CGRectZero will work as well (still not sure why a zero width/height > rectangle should add to a union since be definition it has not > extent/area).
Depends on how you define the union of rectangles. 1) A U B = the smallest rectangle which encompasses all points contained by both A and B. 2) A U B = the smallest rectangle which encompasses all four corner points of both rectangles. The two definitions are identical for rectangles of non-zero size, but definition 2 will give you a rectangle expanded to cover the zero-size rectangle's location. Neither one is any more right than the other. One can be better than the other depending on the particular situation at hand. Obviously the fact that Apple has apparently documented 1 and implemented 2 ought to be corrected, though. Mike _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com