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

Re: [pygame] Issue with pygame.mask



On 14/05/2012 15:54, Nicholas Seward wrote:
I wrote the top comment but I didn't need perfect matching at the
time.  I just dug through the source and found what is going on for
real.  It seem that I was right except you don't get to include the
endpoints.

Yeah, I had a look too. I would still call this is a bug. The similar from_surface() function tests if the value crosses the threshold and uses 'if (a > threshold)'. This function tests if the value is WITHIN the threshold, and should use the complementary 'if (abs((b - a) <= threshold)'.

Regardless, since there is code out in the wild that probably depends on this behaviour it is probably best to just note the quirk in the documentation. Changing the default may also be an option, because I can't think of any reason someone would want the function to be non-functional by default.

Regards,
Peter Finlayson