[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Rect.union and rectangle positions



Hello

Based on the explanation in Pygame's Doc I would say it ignores the current rectangle positions:

Returns a new rectangle that completely covers the area of the two provided rectangles. There may be area inside the new Rect that is not covered by the originals.

I dont know how the new rect is calculated technically but your description sounds good to me. It has to be tested out with some simple examples. Based on the second phrase in Pygame's doc there might be an area inside the new rect that is not covered by the 2 old originals. This means that the surface area of the new rectangle can be bigger than just the addition of the 2 originals. I mention this in matter it is important for your project. That way its not a "proper" union command and you know from set theory or the union of a DB.

Just my 2 cents
Farai


Am 02.12.2006 um 08:08 schrieb Lenard Lindstrom:

Does Rect.union ignore rectangle positions? That is, does it only 
return a rectangle whose width and height is the maximum of the 
widths and heights of the two compared rectangles rather than a 
rectangle that will actually cover the two rectangles as they are 
positioned?


Lenard Lindstrom