Vector math library

M

Martin Vilcans

Hi, I'm new to this mailing list and fairly new to Python as well. I'm
working on a prototype for a 3D game using OpenGL, and take this
opportunity to learn Python better.

I'm looking for a good library for vector math. I need to do vector
addition, cross products, dot products etc. and probably in the future
I'll need matrix math as well.

So far I've used the Scientific library, which is very nice, but
unfortunately it crashes when I use the Rotation class under OSX (which
is my current development environment). I've seen mailing list posts
that suggests that this crash is because of some problem with 64 bit CPUs.

I guess I can find a workaround for this problem, but first I want to
check if there's a better library for vector math. When I googled for
vector libraries, I found people claiming that the Numeric library can
be used for vector math. But skimming the Numeric documentation, I
didn't find a cross product function for instance, but it may just that
I don't understand how to use it.

I also found SciPy, but it doesn't seem to have any vector math in it.
In fact, I'm a bit confused about the libraries SciPy, Scientific,
Numeric and NumericArray and the relations between them.

Any suggestions on what library I should use?

Best regards,

Martin Vilcans
http://www.librador.com
 
B

Bas

I am not a regular user of the libraries that you mention, but I played
around with some of them because I need a replacement for Matlab.

Numeric, NumArray and SciPy should be more or less compatible. All the
functions you mention should be in there, or otherwise should be
trivial to implement. Have a look at the functions cross(), dot(),
inner(), outer(). Addition is just a+b.

As far as I know Numeric was the original vector lib. NumArray was
written as a successor but ended up as a fork due to some speed
concerns. Scipy is the latest and tries to unite the previous two by
implementing the best of both worlds. For future work you should stick
to SciPy. Right now it is probably somewhere in a beta stage, but
expect a final version in half a year or so. Hopefully it ends up being
THE vector lib for python to avoid confusing beginners like you.

Cheers,
Bas
 
J

jelle

martin,

pyformex has a vector module as well.
its not very pythonic, but it could help you out creating a version of
your own.
worth checking out
 
S

Scott David Daniels

Martin said:
Hi, I'm new to this mailing list and fairly new to Python as well. I'm
working on a prototype for a 3D game using OpenGL, and take this
opportunity to learn Python better.

I'm looking for a good library for vector math. I need to do vector
addition, cross products, dot products etc. and probably in the future
I'll need matrix math as well.

Take a quick look at VPython. Should be great for breadboarding your
display and calculations.
 
E

Erik Max Francis

Martin said:
Hi, I'm new to this mailing list and fairly new to Python as well. I'm
working on a prototype for a 3D game using OpenGL, and take this
opportunity to learn Python better.

I'm looking for a good library for vector math. I need to do vector
addition, cross products, dot products etc. and probably in the future
I'll need matrix math as well.

ZOE has an la a module that helps with linear algebra computations
including (three-dimensional) vectors and matrices:

http://www.alcyone.com/software/zoe/
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,252
Latest member
MeredithPl

Latest Threads

Top