intersecting rects

View: New views
2 Messages — Rating Filter:   Alert me  

intersecting rects

by jostM-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

how can I determin if two rects intersect?

the docs say that:


sect(aRect)
& aRect

"returns a new Rect which is the intersection of the receiver and aRect."

-------

however if two rects don't intersect, I still get a (negative) rect:

a=Rect(0,0,50,50);
b=Rect(75,75,75,75);


b.sect(a)

however, this returns Rect(75, 75, -25, -25)

is this a bug?


jostM

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users

Re: intersecting rects

by jostM-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

OK,

now I see that the the .contains method works with rects also. In the
docs it only says it works with points. Should be corrected, or th
.containsRect method should be added to the docs.

Nevertheless, I find the .sect results strange. shouldn't it return nil
in my example?




jostM wrote:

> Hi,
>
> how can I determin if two rects intersect?
>
> the docs say that:
>
>
> sect(aRect)
> & aRect
>
> "returns a new Rect which is the intersection of the receiver and aRect."
>
> -------
>
> however if two rects don't intersect, I still get a (negative) rect:
>
> a=Rect(0,0,50,50);
> b=Rect(75,75,75,75);
>
>
> b.sect(a)
>
> however, this returns Rect(75, 75, -25, -25)
>
> is this a bug?
>
>
> jostM
>
> _______________________________________________
> sc-users mailing list
> sc-users@...
> http://lists.create.ucsb.edu/mailman/listinfo/sc-users
>

_______________________________________________
sc-users mailing list
sc-users@...
http://lists.create.ucsb.edu/mailman/listinfo/sc-users