Author: EricStein Date: 2007-07-06 18:19:01 -0400 (Fri, 06 Jul 2007) New Revision: 385
Added: trunk/pysoy/src/shapes/Box.pxi Modified: trunk/pysoy/src/shapes/soy.shapes.pyx Log: Added Box shape Copied: trunk/pysoy/src/shapes/Box.pxi (from rev 384, trunk/pysoy/src/shapes/Sphere.pxi) =================================================================== --- trunk/pysoy/src/shapes/Box.pxi (rev 0) +++ trunk/pysoy/src/shapes/Box.pxi 2007-07-06 22:19:01 UTC (rev 385) @@ -0,0 +1,43 @@ +# PySoy's soy.shapes.Box class +# +# Copyright (C) 2007 Team PySoy +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, see http://www.gnu.org/licenses +# +# $Id$ + +cdef class Box (Shape) : + '''PySoy Box + + An encapsulated ODE Geom + ''' + + def __new__(self, float lx, float ly, float lz) : + self._geomID = ode.dCreateBox(NULL, lx, ly, lz) + ode.dGeomSetData(self._geomID, <void*> self) + + cdef float pointDepth(self, x, y, z) : + return <float> ode.dGeomBoxPointDepth(self._geomID, x, y, z) + + property dimensions : + '''Sphere's dimensions + + This is the size of the box, (x,y,z) + ''' + def __get__(self) : + cdef ode.dVector3 xyz + ode.dGeomBoxGetLengths(self._geomID, xyz) + return (xyz[0], xyz[1], xyz[2]) + def __set__(self, value) : + ode.dGeomBoxSetLengths(self._geomID, value[0], value[1], value[2]) Modified: trunk/pysoy/src/shapes/soy.shapes.pyx =================================================================== --- trunk/pysoy/src/shapes/soy.shapes.pyx 2007-07-06 21:51:46 UTC (rev 384) +++ trunk/pysoy/src/shapes/soy.shapes.pyx 2007-07-06 22:19:01 UTC (rev 385) @@ -26,3 +26,4 @@ include "Shape.pxi" include "Sphere.pxi" +include "Box.pxi" _______________________________________________ PySoy-SVN mailing list [email protected] http://www.pysoy.org/mailman/listinfo/pysoy-svn
