views:

522

answers:

5

i'm looking for a 3d math library in python or with python bindings.

it needs to handle rotation, translation, perspective projection, everything basically.

what im NOT looking for is a library aimed at drawing on the screen, googling for hours only led to 3d libraries bent on rendering something to the screen. i dont want any visualization whatsoever, all i need is to be able feed a library x,y,z coordinates and recieve the x,y screen coordinates.

i dont mind if its a visualization library, as long as it can be used without rendering anything to the screen.

is there anything like this for python?

Edit: please dont recommend scipy/numpy as they arent aimed at 3d math but at math in general, they look like great tools if i wanted to build the library myself, which i dont. thanks.

+3  A: 

OpenCV - Python Interface can handle all the operations you've mentioned.

I hear SciPy's excellent for this as well, but I've only used OpenCV.

Jacob
Isn't it a "Open Source Computer Vision" library? Which is not a 3D math library?
Ivan Nevostruev
It allows you to do all the operations mentioned above and more. Computer vision, involves a lot of 3D math, btw.
Jacob
I believe that any more specific library will be more sutable for "rotation, translation, perspective projection, everything basically". If you just need to draw rectangle and rotate it then there is nothing about CV here.
Ivan Nevostruev
OpenCV handles the OP's *stated* needs. If it's excessive for the OP, I've recommended SciPy as well.
Jacob
+1 Why the downvote? OpenCV seems to do all the operations the OP asked for.
Andre Miller
Yes, you're right. Didn't read last part of the question.
Ivan Nevostruev
Thanks, this is why I think comments are required on downvotes, else there's no feedback for the person who posted the answer.
Jacob
@Jacob - since 3d operations are a question in OpenCV, could you post some links to some of the specific functionality. For example, the OP wants "feed a library x,y,z coordinates and recieve the x,y screen coordinates", what function is useful for that? And 3d rotations, etc?
tom10
+1  A: 

is SAGE any use to you?
http://vnoel.wordpress.com/2008/05/03/bye-matlab-hello-python-thanks-sage/
http://www.sagemath.org/

gnibbler
thanks for the recommendation, but sage looks like numpy/scipy to me, ive gone through its documentation, seen some examples, and its not aimed at 3d math but at math in general. Thanks anyway.
spearfire
+1  A: 

What about PyGame? I never used it, but it may contain what you're looking for.

EOL
1.) pygame is 2d2.) pygame is trying to draw to the screen , which is not what i want3.) pygame is not a math library its an SDL wrapper4.) no, pygame doesn't contain what im looking forthanks anyway
spearfire
@spearfire: If you click on the link I gave, you get a page with 3D programs that use PyGame. Maybe some use what you are looking for? I was just trying to help by throwing an idea!
EOL
I would add that pyeuclid is compatible with PyGame and seems to be really close to what you want.
EOL
@EOL just checked out pyeuclid, perfect.thanks for the help pyeuclid seems to be exactly what i want, not pygame/pyopengl. thanks for that.
spearfire
A: 

I would suggest MayaVi. Please take a look at the given link. It does almost everything you mentioned.

Madhusudan.C.S
+1  A: 

Try gameobjects -- it's a math library that includes Python classes for matrices and vectors, along with methods for transformations. I think it will provide most (if not all) of what you need, plus it's pure Python so you can modify it if you need to.

Brandon Corfman
you win at the internet! thank you.
spearfire