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

Re: [pygame] 2D Vector Class



Hi

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?

Unfortunately not, but if you are interested in collaborating on a little C/Python library for these kind of things please send me an email.

So far I"ve found this one on the wiki (anybody know who wrote this?):

http://www.pygame.org/wiki/2DVectorClass

This looks a bit slow, but on the other hand it has support for operations I didn't even know I wanted to do on 2-vectors. It also looks like it doesn't support vector scaling, which is a bit of a bummer; one reason for me to have 2-vectors is so that I can write

r += dt*v, where dt is a float and r and v are vectors.

I don't mean to bash the author of that code, but a fast vector
implementation which is designed for "physics" would be nice to have.

The complex number trick was very clever!

Regards,
Ulf