[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] shapes other than rects?



>From: Peter Nicolai <pn275@yahoo.com>
>also on that note, an all-zeros rect is false, which
>is convenient for avoiding the probably-slow numpy
>collision detection (no RLE there)... I was using
>rect.move() when really I wanted to add or subtract.
>maybe some arithmetic operations on rects might be
>useful at some point, does that make sense?
>

Hmm. This is an interesting idea. But I have strong doubts about it being 
right. Someone correct me íf I get anything of this wrong.

if mini_array1 and mini_array2:

Does a logical AND of these two arrays. A logical AND in Python works in the 
fashions that it examines the objects one after another, returning the first 
"false" one or if none are false, the last "true" one. Thus, the objects are 
"coerced" into truth values _before_ the comparison and the object instances 
themselves are not involved in the evaluation, and they are evaluated one by 
one.

In that light it seem extremly unlikely to me that this and operation 
actually _combines_ the two operands. It simply can't... (unless you do some 
serious trickery with globals). And examining them one by one in this manner 
only gives you the answer to the question: Does both of the object have _at 
least one_ pixel set in the rectangular area they have in common? Not if 
they have any overlapping pixels set in any place. Not entierly the same 
thing is it? This ofcourse assuming your statement that all-zero surfarrays 
are false, others true.


Much more likely then that you refer to the '&' operator, a bitwise AND, 
which can be overloaded.

If &'ing two surfarrays together actually produced a value like the one 
you're looking for I'm pretty certain Peter (excuse me) would know about it 
and have mentioned this fact.



This all assuming my limited knowledge hasn't hidden anything from me. 
Please correct me if that's the case :-)
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org