From: Matthias B. <mb...@us...> - 2007-06-05 08:42:19
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15787/src Modified Files: declarations.pyx geomobject.pyx geoms.pyx joints.pyx ode.pyx trimesh.pyx Log Message: Applied a couiple of patches posted by Ethan Glasser-Camp (GeomRay doc strings, angle methods on UniversalJoint, GeomObject.__delattr__, weak refs, triangle count) Index: joints.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/joints.pyx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** joints.pyx 10 Nov 2006 10:43:23 -0000 1.12 --- joints.pyx 5 Jun 2007 08:42:17 -0000 1.13 *************** *** 685,688 **** --- 685,700 ---- dJointAddUniversalTorques(self.jid, torque1, torque2) + def getAngle1(self): + return dJointGetUniversalAngle1(self.jid) + + def getAngle2(self): + return dJointGetUniversalAngle2(self.jid) + + def getAngle1Rate(self): + return dJointGetUniversalAngle1Rate(self.jid) + + def getAngle2Rate(self): + return dJointGetUniversalAngle2Rate(self.jid) + # setParam def setParam(self, param, value): *************** *** 691,695 **** # getParam def getParam(self, param): ! return dJointGetUniversalParam(self.jid, param) --- 703,707 ---- # getParam def getParam(self, param): ! return dJointGetUniversalParam(self.jid, param) Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** declarations.pyx 10 Nov 2006 10:53:40 -0000 1.19 --- declarations.pyx 5 Jun 2007 08:42:17 -0000 1.20 *************** *** 282,285 **** --- 282,289 ---- void dJointGetUniversalAxis2 (dJointID, dVector3 result) dReal dJointGetUniversalParam (dJointID, int parameter) + dReal dJointGetUniversalAngle1 (dJointID) + dReal dJointGetUniversalAngle2 (dJointID) + dReal dJointGetUniversalAngle1Rate (dJointID) + dReal dJointGetUniversalAngle2Rate (dJointID) int dJointGetAMotorNumAxes (dJointID) void dJointGetAMotorAxis (dJointID, int anum, dVector3 result) *************** *** 447,450 **** --- 451,456 ---- dVector3 *v1, dVector3 *v2) + int dGeomTriMeshGetTriangleCount (dGeomID g) + void dGeomTriMeshGetPoint (dGeomID g, int Index, dReal u, dReal v, dVector3 Out) Index: trimesh.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/trimesh.pyx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** trimesh.pyx 15 Nov 2004 20:16:03 -0000 1.4 --- trimesh.pyx 5 Jun 2007 08:42:17 -0000 1.5 *************** *** 92,94 **** --- 92,100 ---- 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) Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.17 retrieving revision 1.18 diff -C2 -d -r1.17 -r1.18 *** ode.pyx 10 Nov 2006 10:53:40 -0000 1.17 --- ode.pyx 5 Jun 2007 08:42:17 -0000 1.18 *************** *** 152,156 **** # Lookup table for geom objects: C ptr -> Python object ! _geom_c2py_lut = {} # Mass --- 152,157 ---- # Lookup table for geom objects: C ptr -> Python object ! import weakref ! _geom_c2py_lut = weakref.WeakValueDictionary() # Mass Index: geomobject.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geomobject.pyx,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** geomobject.pyx 17 Jan 2006 09:07:54 -0000 1.4 --- geomobject.pyx 5 Jun 2007 08:42:17 -0000 1.5 *************** *** 53,56 **** --- 53,58 ---- cdef object attribs + cdef object __weakref__ + def __new__(self, *a, **kw): self.gid = NULL *************** *** 76,79 **** --- 78,87 ---- self.attribs[name]=val + def __delattr__(self, name): + if name in self.attribs: + del self.attribs[name] + else: + raise AttributeError, "geom has no attribute '%s'."%name + def _id(self): """_id() -> int Index: geoms.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geoms.pyx,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** geoms.pyx 10 Nov 2006 10:53:40 -0000 1.13 --- geoms.pyx 5 Jun 2007 08:42:17 -0000 1.14 *************** *** 363,375 **** --- 363,400 ---- def setLength(self, rlen): + '''setLength(rlen) + + Set length of the ray. + + @param rlen: length of the ray + @type rlen: float''' dGeomRaySetLength(self.gid, rlen) def getLength(self): + '''getLength() -> length + + Get the length of the ray. + + @returns: length of the ray (float)''' return dGeomRayGetLength(self.gid) def set(self, p, u): + '''set(p, u) + + Set the position and rotation of a ray. + + @param p: position + @type p: 3-sequence of floats + @param u: rotation + @type u: 3-sequence of floats''' dGeomRaySet(self.gid, p[0],p[1],p[2], u[0],u[1],u[2]) def get(self): + '''get() -> ((p[0], p[1], p[2]), (u[0], u[1], u[2])) + + Return the position and rotation as a pair of + tuples. + + @returns: position and rotation''' cdef dVector3 start cdef dVector3 dir |