• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: CGRectUnion with one empty Rectangle
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: CGRectUnion with one empty Rectangle


  • Subject: Re: CGRectUnion with one empty Rectangle
  • From: Michael Ash <email@hidden>
  • Date: Wed, 20 May 2009 19:15:39 -0400

On Wed, May 20, 2009 at 5:45 PM, Shawn Erickson <email@hidden> wrote:
> On Wed, May 20, 2009 at 1:00 PM, John Harper <email@hidden> 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 (email@hidden)

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:

This email sent to email@hidden

References: 
 >Re: CGRectUnion with one empty Rectangle (From: Gordon Apple <email@hidden>)
 >Re: CGRectUnion with one empty Rectangle (From: John Harper <email@hidden>)
 >Re: CGRectUnion with one empty Rectangle (From: Shawn Erickson <email@hidden>)

  • Prev by Date: Re: Sensible way to extend base class?
  • Next by Date: Re: Sensible way to extend base class?
  • Previous by thread: Re: CGRectUnion with one empty Rectangle
  • Next by thread: using fileWrapperFromRange: for lossy conversion
  • Index(es):
    • Date
    • Thread