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

Re: [pygame] 2D Vector Class



On 5/16/07, Ethan Glasser-Camp <glasse@xxxxxxxxxx> wrote:
John Krukoff wrote:
> I'd guess that numeric/numpy is probably a good way to do this too, but
> I've been trying to avoid pulling that in as a dependency.

How about making a very simple C library, which only does vectors of doubles? I am thinking of a basic class that supports addition, subtraction, scaling and dot product for arbitrary length vectors. Then this could be used for implementing 2d and 3d vectors in Python, with the more geometrical operations implemented in python. This would be some kind of light weight numeric, I guess.

I wrote a physics system using Numeric. It still wasn't fast enough.

Do you know exactly what made it slow? Do you think it can be worked around assuming we have fast vector operations?

Regards,
Ulf