Re: CGRectUnion with one empty Rectangle
Re: CGRectUnion with one empty Rectangle
- Subject: Re: CGRectUnion with one empty Rectangle
- From: Gordon Apple <email@hidden>
- Date: Wed, 20 May 2009 13:45:45 -0500
- Thread-topic: CGRectUnion with one empty Rectangle
IMHO, if it works the way you describe, it's doing the right thing, at least
mathematically speaking from a point-set viewpoint. Unfortunately,
NSUnionRect works like the docs describe, which is not what I needed, so I
wrote my own. It's too bad NSUnionRect and CGRectUnion appear to not be
consistent. I believe the thinking (at least for NSUnionRect) is that an
empty rect is no rect -- sort of an area zero.
The important thing is to know exactly WHAT they are doing and either accept
it, or roll your own. This stuff is probably too deeply embedded in
everything to expect them to change it.
> I just stumbled over this issue with CGRectUnion when one operand is
> an empty rect, or has negative width or hight:
>
> CGRect r1 = CGRectZero;
> CGRect r2 = CGRectMake(100.0, 100.0, 300.0, 300.0);
> CGRect r3 = CGRectUnion(r1, r2);
>
> the result for r3 is actually :
> r3.origin: (0, 0)
> r3.size: (300, 300)
>
>
>
> However, according the docs:
> "if one of the rectangles has 0 (or negative) width or height, a copy
> of the other rectangle is returned; "
_______________________________________________
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