Rats. This change seems to have broke test_platformer.py


On Thu, May 30, 2013 at 12:55 AM, claudio canepa <[email protected]>wrote:

>
>
>
> On Tue, May 28, 2013 at 12:09 PM, Gerardo Marset <[email protected]>wrote:
>
>> I think there's a bug in tiles.RectMap.get_in_region.
>>
> [...]
>
> You are right, thanks for the report, analysis and fix suggestion.
>
>
>> The solution I found is the following:
>> x2 = min(len(self.cells), math.ceil(float(x2 - ox) / self.tw))
>> y2 = min(len(self.cells[0]), math.ceil(float(y2 - oy) / self.th))
>>
>> In this example, the first equation is:
>> 4 for x2 = 8
>> 4 for x2 = 7
>> 3 for x2 = 6
>> 5 for x2 = 8.1
>>
>> Which is perfect if I'm not mistaken.
>>
>
>
> It works, but instead of
>      math.ceil(float(x2 - ox) / self.tw)
> I used
>     (x2 - ox - 1) // self.tw + 1
> which is a bit faster.
>
> Caveat: the corner case where the rect is a segment is a bit inconsistent,
> see [0] for details.
>
> unit tests, fix, better docstring committed at r1226-1230
>
> PD: I will need one or two days to integrate the patch for anisotropic
> scaling, thanks.
>
>
> [0] http://code.google.com/p/los-cocos/issues/detail?id=191
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to