Author: EricStein
Date: 2007-07-09 01:06:55 -0400 (Mon, 09 Jul 2007)
New Revision: 443

Added:
   trunk/pysoy/src/shapes/Ray.pxi
Modified:
   trunk/pysoy/src/shapes/soy.shapes.pyx
Log:
Added Ray


Added: trunk/pysoy/src/shapes/Ray.pxi
===================================================================
--- trunk/pysoy/src/shapes/Ray.pxi                              (rev 0)
+++ trunk/pysoy/src/shapes/Ray.pxi      2007-07-09 05:06:55 UTC (rev 443)
@@ -0,0 +1,66 @@
+# PySoy's soy.shapes.Ray 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 Ray (Shape) :
+  '''PySoy Ray
+
+     An encapsulated ODE Geom
+  '''
+
+  def __new__(self, float length) :
+    self._geomID = ode.dCreateRay(NULL, length)
+    ode.dGeomSetData(self._geomID, <void*> self)
+
+  property length :
+    '''Ray's length
+
+       This is the distance from the starting point of the ray and its end
+    '''
+    def __get__(self) :
+      return ode.dGeomRayGetLength(self._geomID)
+    def __set__(self, value) :
+      ode.dGeomRaySetLength(self._geomID, value)
+
+  property start :
+    '''Ray's start
+
+       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])
+    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])
+
+  property direction :
+    '''Ray's direction
+
+       The normal vector of the ray (does not adjust length)
+    '''
+    def __get__(self) :
+      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])


Property changes on: trunk/pysoy/src/shapes/Ray.pxi
___________________________________________________________________
Name: svn:keywords
   + Id

Modified: trunk/pysoy/src/shapes/soy.shapes.pyx
===================================================================
--- trunk/pysoy/src/shapes/soy.shapes.pyx       2007-07-09 05:06:55 UTC (rev 
442)
+++ trunk/pysoy/src/shapes/soy.shapes.pyx       2007-07-09 05:06:55 UTC (rev 
443)
@@ -28,3 +28,4 @@
 include "Sphere.pxi"
 include "Box.pxi"
 include "CCylinder.pxi"
+include "Ray.pxi"

_______________________________________________
PySoy-SVN mailing list
[email protected]
http://www.pysoy.org/mailman/listinfo/pysoy-svn

Reply via email to