Author: JonNeal Date: 2008-07-18 02:44:08 -0400 (Fri, 18 Jul 2008) New Revision: 1332
Modified: trunk/pysoy/src/shapes/Box.pym trunk/pysoy/src/shapes/Capsule.pym trunk/pysoy/src/shapes/Ray.pym trunk/pysoy/src/shapes/Sphere.pym Log: No Ticket: * Fixed a few variable names in soy.shapes, also added a bit more to the docs. Modified: trunk/pysoy/src/shapes/Box.pym =================================================================== --- trunk/pysoy/src/shapes/Box.pym 2008-07-18 06:09:41 UTC (rev 1331) +++ trunk/pysoy/src/shapes/Box.pym 2008-07-18 06:44:08 UTC (rev 1332) @@ -21,6 +21,7 @@ '''PySoy Box A rectangular prism shape. + Takes the x, y, and z side dimensions as floats. ''' ############################################################################ @@ -28,8 +29,8 @@ # Python functions # - def __cinit__(self, float lx, float ly, float lz) : - self._geomID = ode.dCreateBox(NULL, lx, ly, lz) + def __cinit__(self, float _lx, float _ly, float _lz) : + self._geomID = ode.dCreateBox(NULL, _lx, _ly, _lz) ode.dGeomSetCategoryBits(self._geomID, 2) # GeomBody ode.dGeomSetData(self._geomID, <void*> self) @@ -49,6 +50,9 @@ ode.dGeomBoxGetLengths(self._geomID, xyz) return (xyz[0], xyz[1], xyz[2]) def __set__(self, value) : + assert type(value) != tuple or type(value) != list, \ + "Must provide a tuple or list for box dimensions" + assert len(value) == 3, "Must provide (x,y,z)" ode.dGeomBoxSetLengths(self._geomID, value[0], value[1], value[2]) Modified: trunk/pysoy/src/shapes/Capsule.pym =================================================================== --- trunk/pysoy/src/shapes/Capsule.pym 2008-07-18 06:09:41 UTC (rev 1331) +++ trunk/pysoy/src/shapes/Capsule.pym 2008-07-18 06:44:08 UTC (rev 1332) @@ -21,6 +21,7 @@ '''PySoy Capsule A capped cylinder shape. + Takes the radies and length of the capsule as floats. ''' ############################################################################ @@ -28,8 +29,8 @@ # Python functions # - def __cinit__(self, float radius, float length) : - self._geomID = ode.dCreateCapsule(NULL, radius, length) + def __cinit__(self, float _radius, float _length) : + self._geomID = ode.dCreateCapsule(NULL, _radius, _length) ode.dGeomSetData(self._geomID, <void*> self) @@ -44,14 +45,14 @@ This is the distance between the center and the surface ''' def __get__(self) : - cdef ode.dReal r, l - ode.dGeomCapsuleGetParams(self._geomID, &r, &l) - return r + cdef ode.dReal _r, _l + ode.dGeomCapsuleGetParams(self._geomID, &_r, &_l) + return _r def __set__(self, value) : - cdef ode.dReal r, l - ode.dGeomCapsuleGetParams(self._geomID, &r, &l) - r = value - ode.dGeomCapsuleSetParams(self._geomID, r, l) + cdef ode.dReal _r, _l + ode.dGeomCapsuleGetParams(self._geomID, &_r, &_l) + _r = value + ode.dGeomCapsuleSetParams(self._geomID, _r, _l) property length : @@ -60,14 +61,14 @@ This is the length, not counting the caps ''' def __get__(self) : - cdef ode.dReal r, l - ode.dGeomCapsuleGetParams(self._geomID, &r, &l) - return l + cdef ode.dReal _r, _l + ode.dGeomCapsuleGetParams(self._geomID, &_r, &_l) + return _l def __set__(self, value) : - cdef ode.dReal r, l - ode.dGeomCapsuleGetParams(self._geomID, &r, &l) - l = value - ode.dGeomCapsuleSetParams(self._geomID, r, l) + cdef ode.dReal _r, _l + ode.dGeomCapsuleGetParams(self._geomID, &_r, &_l) + _l = value + ode.dGeomCapsuleSetParams(self._geomID, _r, _l) ############################################################################ Modified: trunk/pysoy/src/shapes/Ray.pym =================================================================== --- trunk/pysoy/src/shapes/Ray.pym 2008-07-18 06:09:41 UTC (rev 1331) +++ trunk/pysoy/src/shapes/Ray.pym 2008-07-18 06:44:08 UTC (rev 1332) @@ -21,6 +21,7 @@ '''PySoy Ray A line or line segment in 3d space. + Takes the ray length as a float. ''' ############################################################################ @@ -28,8 +29,8 @@ # Python functions # - def __cinit__(self, float length) : - self._geomID = ode.dCreateRay(NULL, length) + def __cinit__(self, float _length) : + self._geomID = ode.dCreateRay(NULL, _length) ode.dGeomSetData(self._geomID, <void*> self) @@ -41,7 +42,7 @@ property length : '''Ray's length - This is the distance from the starting point of the ray and its end + This is the distance from the starting point of the ray to its end ''' def __get__(self) : return ode.dGeomRayGetLength(self._geomID) @@ -54,13 +55,13 @@ The starting point, relative to the center of the associated Body ''' def __get__(self) : - cdef ode.dVector3 s, d - ode.dGeomRayGet(self._geomID, s, d) - return (s[0], s[1], s[2]) + cdef ode.dVector3 _s, _d + ode.dGeomRayGet(self._geomID, _s, _d) + return (_s[0], _s[1], _s[2]) def __set__(self, value) : - cdef ode.dVector3 s, d - ode.dGeomRayGet(self._geomID, s, d) - ode.dGeomRaySet(self._geomID, value[0], value[1], value[2], d[0], d[1], d[2]) + cdef ode.dVector3 _s, _d + ode.dGeomRayGet(self._geomID, _s, _d) + ode.dGeomRaySet(self._geomID, value[0], value[1], value[2], _d[0], _d[1], _d[2]) property direction : '''Ray's direction @@ -68,13 +69,13 @@ The normal vector of the ray (does not adjust length) ''' def __get__(self) : - cdef ode.dVector3 s, d - ode.dGeomRayGet(self._geomID, s, d) + cdef ode.dVector3 _s, _d + ode.dGeomRayGet(self._geomID, _s, _d) return (d[0], d[1], d[2]) def __set__(self, value) : - cdef ode.dVector3 s, d - ode.dGeomRayGet(self._geomID, s, d) - ode.dGeomRaySet(self._geomID, s[0], s[1], s[2], value[0], value[1], value[2]) + cdef ode.dVector3 _s, _d + ode.dGeomRayGet(self._geomID, _s, _d) + ode.dGeomRaySet(self._geomID, _s[0], _s[1], _s[2], value[0], value[1], value[2]) ############################################################################ Modified: trunk/pysoy/src/shapes/Sphere.pym =================================================================== --- trunk/pysoy/src/shapes/Sphere.pym 2008-07-18 06:09:41 UTC (rev 1331) +++ trunk/pysoy/src/shapes/Sphere.pym 2008-07-18 06:44:08 UTC (rev 1332) @@ -21,6 +21,7 @@ '''PySoy Sphere A spherical shape class. + Takes the circles radius as a float. ''' ############################################################################ @@ -28,8 +29,8 @@ # Python functions # - def __cinit__(self, float radius) : - self._geomID = ode.dCreateSphere(NULL, radius) + def __cinit__(self, float _radius) : + self._geomID = ode.dCreateSphere(NULL, _radius) ode.dGeomSetData(self._geomID, <void*> self) _______________________________________________ PySoy-SVN mailing list PySoy-SVN@pysoy.org http://www.pysoy.org/mailman/listinfo/pysoy-svn