From: Matthias B. <mb...@us...> - 2006-11-10 10:53:42
|
Update of /cvsroot/pyode/pyode/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23804/src Modified Files: declarations.pyx geoms.pyx ode.pyx Log Message: Applied another patch that adds support for the GeomCylinder class. Index: ode.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/ode.pyx,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** ode.pyx 10 Nov 2006 10:43:23 -0000 1.16 --- ode.pyx 10 Nov 2006 10:53:40 -0000 1.17 *************** *** 65,68 **** --- 65,69 ---- - GeomPlane - GeomCapsule + - GeomCylinder - GeomRay - GeomTransform Index: geoms.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/geoms.pyx,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** geoms.pyx 10 Nov 2006 10:43:23 -0000 1.12 --- geoms.pyx 10 Nov 2006 10:53:40 -0000 1.13 *************** *** 274,277 **** --- 274,326 ---- + # GeomCylinder + cdef class GeomCylinder(GeomObject): + """Plain cylinder geometry. + + This class represents an uncapped cylinder aligned along the local Z axis + and centered at the origin. + + Constructor:: + + GeomCylinder(space=None, radius=0.5, length=1.0) + """ + + def __new__(self, space=None, radius=0.5, length=1.0): + cdef SpaceBase sp + cdef dSpaceID sid + + sid=NULL + if space!=None: + sp = space + sid = sp.sid + self.gid = dCreateCylinder(sid, radius, length) + # if space!=None: + # space._addgeom(self) + + _geom_c2py_lut[<long>self.gid]=self + + def __init__(self, space=None, radius=0.5, length=1.0): + self.space = space + self.body = None + + def placeable(self): + return True + + def _id(self): + cdef long id + id = <long>self.gid + return id + + def setParams(self, radius, length): + dGeomCylinderSetParams(self.gid, radius, length) + + def getParams(self): + cdef dReal radius, length + dGeomCylinderGetParams(self.gid, &radius, &length) + return (radius, length) + + ## dGeomCylinderPointDepth not implemented upstream in ODE 0.7 + + # GeomRay cdef class GeomRay(GeomObject): Index: declarations.pyx =================================================================== RCS file: /cvsroot/pyode/pyode/src/declarations.pyx,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** declarations.pyx 10 Nov 2006 10:43:23 -0000 1.18 --- declarations.pyx 10 Nov 2006 10:53:40 -0000 1.19 *************** *** 355,358 **** --- 355,359 ---- dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d) dGeomID dCreateCapsule (dSpaceID space, dReal radius, dReal length) + dGeomID dCreateCylinder (dSpaceID space, dReal radius, dReal length) dGeomID dCreateGeomGroup (dSpaceID space) *************** *** 361,364 **** --- 362,366 ---- void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d) void dGeomCapsuleSetParams (dGeomID ccylinder, dReal radius, dReal length) + void dGeomCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length) dReal dGeomSphereGetRadius (dGeomID sphere) *************** *** 366,369 **** --- 368,372 ---- void dGeomPlaneGetParams (dGeomID plane, dVector4 result) void dGeomCapsuleGetParams (dGeomID ccylinder, dReal *radius, dReal *length) + void dGeomCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length) dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z) |