Browse Source

added get_AABB functionality

Josh Wilson 19 years ago
parent
commit
15c717ad3f

+ 9 - 0
direct/src/extensions/OdeGeom-extensions.py

@@ -33,3 +33,12 @@ def getConvertedSpace(self):
     """
     """
     """
     """
     return self.getSpace().convert()
     return self.getSpace().convert()
+
+def getAABounds(self):
+    """
+    A more Pythonic way of calling getAABB().
+    """
+    min = Point3()
+    max = Point3()
+    self.getAABB(min,max)
+    return min,max

+ 9 - 0
direct/src/extensions/OdeSpace-extensions.py

@@ -21,3 +21,12 @@ def getConvertedSpace(self):
     """
     """
     """
     """
     return self.getSpace().convert()
     return self.getSpace().convert()
+
+def getAABounds(self):
+    """
+    A more Pythonic way of calling getAABB()
+    """
+    min = Point3()
+    max = Point3()
+    self.getAABB(min,max)
+    return min,max

+ 12 - 0
direct/src/extensions_native/OdeGeom_extensions.py

@@ -50,3 +50,15 @@ def getConvertedSpace(self):
     return self.getSpace().convert()
     return self.getSpace().convert()
 Dtool_funcToMethod(getConvertedSpace, OdeGeom)
 Dtool_funcToMethod(getConvertedSpace, OdeGeom)
 del getConvertedSpace
 del getConvertedSpace
+
+def getAABounds(self):
+    """
+    A more Pythonic way of calling getAABB()
+    """
+    min = Point3()
+    max = Point3()
+    self.getAABB(min,max)
+    return min,max
+Dtool_funcToMethod(getAABounds, OdeGeom)
+del getAABounds
+

+ 11 - 0
direct/src/extensions_native/OdeSpace_extensions.py

@@ -41,3 +41,14 @@ def getConvertedSpace(self):
 Dtool_funcToMethod(getConvertedSpace, OdeSpace)
 Dtool_funcToMethod(getConvertedSpace, OdeSpace)
 del getConvertedSpace
 del getConvertedSpace
 
 
+def getAABounds(self):
+    """
+    A more Pythonic way of calling getAABB()
+    """
+    min = Point3()
+    max = Point3()
+    self.getAABB(min,max)
+    return min,max
+Dtool_funcToMethod(getAABounds, OdeSpace)
+del getAABounds
+

+ 5 - 4
panda/src/ode/odeGeom.I

@@ -83,12 +83,13 @@ get_quaternion() const {
   return LQuaternionf(res[0], res[1], res[2], res[3]);
   return LQuaternionf(res[0], res[1], res[2], res[3]);
 }
 }
 
 
-/*
 INLINE void OdeGeom::
 INLINE void OdeGeom::
-get_aabb(dReal aabb[6]) const {
-  return dGeomGetAABB(_id, aabb[6]);
+get_AABB(LVecBase3f &min, LVecBase3f &max) const {
+  dReal result[6];
+  dGeomGetAABB(_id, result);
+  min.set(result[0], result[2], result[4]);
+  max.set(result[1], result[3], result[5]);
 }
 }
-*/
 
 
 INLINE int OdeGeom::
 INLINE int OdeGeom::
 is_space() {
 is_space() {

+ 1 - 1
panda/src/ode/odeGeom.h

@@ -82,7 +82,7 @@ PUBLISHED:
   INLINE LPoint3f get_position() const;
   INLINE LPoint3f get_position() const;
   INLINE LMatrix3f get_rotation() const;
   INLINE LMatrix3f get_rotation() const;
   INLINE LQuaternionf get_quaternion() const;
   INLINE LQuaternionf get_quaternion() const;
-  //INLINE void get_aabb(dReal aabb[6]) const;
+  INLINE void get_AABB(LVecBase3f &min, LVecBase3f &max) const;
   INLINE int is_space();
   INLINE int is_space();
   INLINE int get_class() const;
   INLINE int get_class() const;
   INLINE void set_category_bits(const BitMask32 &bits);
   INLINE void set_category_bits(const BitMask32 &bits);

+ 5 - 4
panda/src/ode/odeSpace.I

@@ -42,12 +42,13 @@ get_space() const {
   return OdeSpace(dGeomGetSpace((dGeomID)_id));
   return OdeSpace(dGeomGetSpace((dGeomID)_id));
 }
 }
 
 
-/*
 INLINE void OdeSpace::
 INLINE void OdeSpace::
-get_aabb(dReal aabb[6]) const {
-  return dGeomGetAABB((dGeomID)_id, aabb[6]);
+get_AABB(LVecBase3f &min, LVecBase3f &max) const {
+  dReal result[6];
+  dGeomGetAABB((dGeomID)_id, result);
+  min.set(result[0], result[2], result[4]);
+  max.set(result[1], result[3], result[5]);
 }
 }
-*/
 
 
 INLINE int OdeSpace::
 INLINE int OdeSpace::
 is_space() {
 is_space() {

+ 1 - 1
panda/src/ode/odeSpace.h

@@ -51,7 +51,7 @@ PUBLISHED:
   INLINE int query(const OdeGeom& geom) const;
   INLINE int query(const OdeGeom& geom) const;
   INLINE int query(const OdeSpace& space) const;
   INLINE int query(const OdeSpace& space) const;
   INLINE int get_num_geoms() const;
   INLINE int get_num_geoms() const;
-  // INLINE void get_aabb() const;  
+  INLINE void get_AABB(LVecBase3f &min, LVecBase3f &max) const;
   INLINE int is_space();
   INLINE int is_space();
   INLINE int get_class() const;
   INLINE int get_class() const;
   INLINE void set_category_bits(const BitMask32 &bits);
   INLINE void set_category_bits(const BitMask32 &bits);