3D geometry module?

Mike C. Fletcher mcfletch at rogers.com
Thu Aug 26 18:35:02 CEST 2004


Will McGugan wrote:

> Hi,
>
> Is there a general purpose 3D geometry module for Python? I would like 
> to be able to read / write 3D models and perform per vertex / per face 
> operations on them.

Pivy gives you an Inventor mechanism for loading .iv and .wrl (VRML97) 
files, not sure how it handles exposing faces/points, but I'd imagine 
it's fairly straightforward.

OpenGLContext will read/write VRML97 files, and (though it's not set up 
for it as an API feature) let you process the vertices/faces (there's 
code in there that will tessellate the faces, for instance, though you 
need an OpenGL context to do it), see the IndexedFaceSet implementation 
for example code.

There is at least one module that loads 3DS files.

You could use Blender's in-program scripting support for any format it 
supports.

I think the U of Waterloo people have a .obj loader, but I'm not sure if 
it's open-source or not.

Don't think anyone has a 3DSMax .ASC loader, (which would be really nice).

> Failing that, are there vector / matrix / quaternion classes I can 
> make use of?

I tend to use Numpy for vector and matrix.  Both PyOpenGL and 
OpenGLContext have quaternion classes available, there's a few more in 
various other packages.

Have fun,
Mike

________________________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://www.vrplumber.com
  http://blog.vrplumber.com




More information about the Python-list mailing list