3d Math Library For Python

15,658

Solution 1

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.

Solution 2

transformations.py

A library for calculating 4x4 matrices for translating, rotating, reflecting, scaling, shearing, projecting, orthogonalizing, and superimposing arrays of 3D homogeneous coordinates as well as for converting between rotation matrices, Euler angles, and quaternions. Also includes an Arcball control object and functions to decompose transformation matrices.

Authors: Christoph Gohlke http://www.lfd.uci.edu/~gohlke/ Laboratory for Fluorescence Dynamics, University of California, Irvine

Solution 3

I'm working on one now. https://github.com/adamlwgriffiths/Pyrr

It uses numpy for speed. The aim is to provide a pure python 3D maths lib.

I'm avoiding external libs because I'm sick of having to follow complex software installs. Python should be easy.

Solution 4

python-math3d is another good 3D mathematic library which is object oriented https://github.com/mortlind/pymath3d

import math3d as m3d

v = m3d.Vector(1,2,3) # A vector object

o = m3d.Orientation.new_euler((1,0,0), "ZYX") # An Orientation object from one type of euler angles

t = m3d.Transform(o, v) # A Transform object created using the vector and orientation

t2 = m3d.Transform()# Another Transform object (Identity)

t2.orient.rotate_x(3) # rotate the transformation around x

res = t * t2 #Matrix multiplication

Solution 5

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

Share:
15,658
spearfire
Author by

spearfire

Updated on June 06, 2022

Comments

  • spearfire
    spearfire almost 2 years

    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.