Update of /cvsroot/pyode/pyode/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21008/src
Modified Files:
declarations.pyx geomobject.pyx
Log Message:
Added the getQuaternion()/setQuaternion() methods to the geom base class
Index: declarations.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** declarations.pyx 5 May 2005 17:41:33 -0000 1.13
--- declarations.pyx 17 Jan 2006 09:07:54 -0000 1.14
***************
*** 366,371 ****
--- 366,373 ----
void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z)
void dGeomSetRotation (dGeomID, dMatrix3 R)
+ void dGeomSetQuaternion (dGeomID, dQuaternion)
dReal * dGeomGetPosition (dGeomID)
dReal * dGeomGetRotation (dGeomID)
+ void dGeomGetQuaternion (dGeomID, dQuaternion result)
void dGeomDestroy (dGeomID)
void dGeomGetAABB (dGeomID, dReal aabb[6])
Index: geomobject.pyx
===================================================================
RCS file: /cvsroot/pyode/pyode/src/geomobject.pyx,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** geomobject.pyx 3 Mar 2005 09:36:16 -0000 1.3
--- geomobject.pyx 17 Jan 2006 09:07:54 -0000 1.4
***************
*** 189,192 ****
--- 189,224 ----
return [m[0],m[1],m[2],m[4],m[5],m[6],m[8],m[9],m[10]]
+ def getQuaternion(self):
+ """getQuaternion() -> (w,x,y,z)
+
+ Get the current orientation of the geom. If the geom is attached to
+ a body the returned value is the body's orientation.
+ """
+ if not self.placeable():
+ raise ValueError, "Non-placeable geoms do not have an orientation."
+
+ cdef dQuaternion q
+ dGeomGetQuaternion(self.gid, q)
+ return (q[0],q[1],q[2],q[3])
+
+ def setQuaternion(self, q):
+ """setQuaternion(q)
+
+ Set the orientation of the geom. If the geom is attached to a body,
+ the body's orientation will also be changed.
+
+ @param q: Quaternion (w,x,y,z)
+ @type q: 4-sequence of floats
+ """
+ if not self.placeable():
+ raise ValueError, "Cannot set a quaternion on non-placeable geoms."
+
+ cdef dQuaternion cq
+ cq[0] = q[0]
+ cq[1] = q[1]
+ cq[2] = q[2]
+ cq[3] = q[3]
+ dGeomSetQuaternion(self.gid, cq)
+
def getAABB(self):
"""getAABB() -> 6-tuple
|