Collision of rotated rectangles without pygame

Martin Manns mmanns at gmx.net
Tue Dec 7 17:47:16 EST 2010


On Tue, 07 Dec 2010 00:53:27 -0800
John Nagle <nagle at animats.com> wrote:

> On 12/5/2010 2:49 PM, Martin Manns wrote:
>     Probably because you seem to be trying to compute the intersection
> point for coincident lines, which is not well-defined.

I found the problem: 
pygame returns one pixel more for the right border than wx.

>     Incidentally, a dictionary lookup in Python is far more expensive
> than computing trig functions.  If you need to speed this up
> for large numbers of rectangles, there are algorithms that are
> several orders of magnitude faster.  Realistically, though,
> this is the kind of problem that runs slow in CPython.

This was taken from the vizier code. I fixed it.

>     This is why you don't write your own collision library.
> (I once did, for 3D, but that was in 1996, when it was
> cutting-edge technology.)

Is there a pure Python collision library other than vizier?

Martin



More information about the Python-list mailing list