christopher taylor wrote:
> my next big issue is getting the triangles from a GeomTriMesh object,
> unfortunately the sources to pyode and the documentation for pyode
> indicate that this could happen getTriangle is available.
> 
> unfortunately, it just isn't going to happen until a method for
> getting the triangle index values is exposed in the pyode api.

Sorry, it took me a long time to understand what you meant here.

Attached is a patch which adds a getTriangleCount method to
GeomTriMesh, using the dGeomGetTriangleCount function from ODE. I
can't test it right now, but feel free to complain if it doesn't work.

Ethan
Index: src/declarations.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v
retrieving revision 1.19
diff -u -r1.19 declarations.pyx
--- src/declarations.pyx	10 Nov 2006 10:53:40 -0000	1.19
+++ src/declarations.pyx	30 May 2007 00:14:38 -0000
@@ -446,6 +450,8 @@
     void dGeomTriMeshGetTriangle (dGeomID g, int Index, dVector3 *v0,
                                   dVector3 *v1, dVector3 *v2)
 
+    int dGeomTriMeshGetTriangleCount (dGeomID g)
+
     void dGeomTriMeshGetPoint (dGeomID g, int Index, dReal u, dReal v,
                                dVector3 Out)
 
Index: src/trimesh.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/trimesh.pyx,v
retrieving revision 1.4
diff -u -r1.4 trimesh.pyx
--- src/trimesh.pyx	15 Nov 2004 20:16:03 -0000	1.4
+++ src/trimesh.pyx	30 May 2007 00:14:39 -0000
@@ -91,4 +91,10 @@
         dGeomTriMeshGetTriangle(self.gid, idx, vp0, vp1, vp2)
         return ((v0[0],v0[1],v0[2]), (v1[0],v1[1],v1[2]), (v2[0],v2[1],v2[2]))
         
+    def getTriangleCount(self):
+        """getTriangleCount() -> n
+
+        Returns the number of triangles in the TriMesh."""
+
+        return dGeomTriMeshGetTriangleCount(self.gid)
 

Attachment: signature.asc
Description: OpenPGP digital signature

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Pyode-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pyode-user

Reply via email to