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

Re: [pygame] Python and Speed



On Thu, Apr 17, 2008 at 12:15 PM, Casey Duncan <casey@xxxxxxxxxxx> wrote:
Note this is not the most efficient way to do this, using a partitioned space you may be able to avoid comparing most points with one another most of the time. To do this in 2D you could use quad-trees, in 3D you could use oct-trees. See: http://en.wikipedia.org/wiki/Octree
Yes, I've tried this, but there are issues with points being in two separate places.  For example, if the collision radius is 5, and it is 3 away from the edge, then all the points in the neighboring trees must be tested.   

Note ode already implements efficient 3D collision detection in naive code, I believe pymunk does this for 2D. pyode is a python wrapper for ode.
I'll look into it.   

FWIW, you would get better answers to your problems by asking more specific questions. If you had asked "How do I make collision detection faster?" you would have gotten much better answers than asking "How do I make Python faster?".
Well, my question was actually how can "Python be made faster"?  The collision detection was an example of where it is a problem.  
-Casey
Ian