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

Re: [pygame] Rect.union and rectangle positions



On 2 Dec 2006 at 14:10, Farai Aschwanden wrote:

> 
> 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.
> 

Thanks for the information. After correcting an error I was making in 
calling pygame.Rect and Brian Fisher's informative example I find 
that Rect.union creates a boundary rectangle that not only takes the 
sizes of the two source rectangles into account, but also their 
positions. This is good (for me). Knowing this I have since solved my 
original problem.

Lenard Lindstrom
<len-l@xxxxxxxxx>