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

Re: [pygame] 2D Vector Class




So, I’ve been working on a simple physics system, and have gotten to the point where passing around a tuple just isn’t cutting it. Can anybody suggest a good 2D vector implementation?

This thread came up sometime last year, and several implementations were put forward.  

If you're happy to put all of your vectors into a single numpy/numeric array, that is the fastest approach.  

CGKit (http://cgkit.sourceforge.net/) is a C extension which is the fastest vector-is-an-object implementation.  Unless things have changed recently though, this library is a nightmare to compile and install.

For pure Python, the fastest implementation is my euclid module: http://partiallydisassembled.net/euclid.html (some comparison results were posted in the previous thread).

Cheers
Alex.