473,395 Members | 1,368 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Vector math library

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
Dec 31 '05 #1
5 9973
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

Dec 31 '05 #2
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

Dec 31 '05 #3
Martin Vilcans wrote:
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.
--
-Scott David Daniels
sc***********@acm.org
Dec 31 '05 #4
And then more!

I started out using cgtypes from the cgkit. Lots of other graphics
goodies in there also:

http://cgkit.sourceforge.net/doc/cgtypes.html

In the end I ended up rolling my own to better understand the whole
thing.

Dec 31 '05 #5
Martin Vilcans wrote:
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/

--
Erik Max Francis && ma*@alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
You are the lovers rock / The rock that I cling to
-- Sade
Dec 31 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: {AGUT2}=IWIK= | last post by:
Hello all, It's my fisrt post here and I am feeling a little stupid here, so go easy.. :) (Oh, and I've spent _hours_ searching...) I am desperately trying to read in an ASCII...
19
by: Carlo Milanesi | last post by:
Mathematically speaking, a 'vector' is something you can add to another vector and multiply by a number. But in C++, the following code is illegal: std::vector<double> v1(3), v2(3); v1 + v2; //...
8
by: Stefan Burger | last post by:
Those of you who are in need for drawing vector lines might be interested in the following code. DrawLine( x1, y1, x2, y2, color ) draws a vector line from any Point x1,y1 to any Point x2,y2 in...
1
by: Bernhard Hidding | last post by:
Hello, I'm a beginner in c++ and I would like to implement some math operations into my program. Explicitly, would like to perform cross product calculations. Is there some library or predefined...
14
by: Michael Sgier | last post by:
Hello If someone could explain the code below to me would be great. // return angle between two vectors const float inline Angle(const CVector& normal) const { return acosf(*this % normal); }...
8
by: Sensei | last post by:
I have a quick question about the math library included in the standard C90 (and 99). The gcc, xlc and possibly other compilers/linkers on some unix platforms cannot use any math functions in...
110
by: Gregory Pietsch | last post by:
I'm writing a portable implementation of the C standard library for http://www.clc-wiki.net and I was wondering if someone could check the functions in math.h for sanity/portability/whatever. I'm...
5
by: =?iso-8859-1?B?TWF0dGlhcyBCcuRuZHN0cvZt?= | last post by:
Hello! I'm trying to find what package I should use if I want to: 1. Create 3d vectors. 2. Normalize those vectors. 3. Create a 3x3 rotation matrix from a unit 3-d vector and an angle in...
3
by: Francogrex | last post by:
Hello, I am new to C++, have some knowledge of programming in splus(statistics). I am trying to append values output by a loop (code below) into a vector (by appending value), that I can eventually...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.