From 15c717ad3f9b1387774e4d3329b2b63efeae4384 Mon Sep 17 00:00:00 2001 From: Josh Wilson Date: Sun, 11 Feb 2007 07:57:32 +0000 Subject: [PATCH] added get_AABB functionality --- direct/src/extensions/OdeGeom-extensions.py | 9 +++++++++ direct/src/extensions/OdeSpace-extensions.py | 9 +++++++++ direct/src/extensions_native/OdeGeom_extensions.py | 12 ++++++++++++ direct/src/extensions_native/OdeSpace_extensions.py | 11 +++++++++++ panda/src/ode/odeGeom.I | 9 +++++---- panda/src/ode/odeGeom.h | 2 +- panda/src/ode/odeSpace.I | 9 +++++---- panda/src/ode/odeSpace.h | 2 +- 8 files changed, 53 insertions(+), 10 deletions(-) diff --git a/direct/src/extensions/OdeGeom-extensions.py b/direct/src/extensions/OdeGeom-extensions.py index 2d523788c3..0796dc5cf7 100755 --- a/direct/src/extensions/OdeGeom-extensions.py +++ b/direct/src/extensions/OdeGeom-extensions.py @@ -33,3 +33,12 @@ def getConvertedSpace(self): """ """ 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 \ No newline at end of file diff --git a/direct/src/extensions/OdeSpace-extensions.py b/direct/src/extensions/OdeSpace-extensions.py index 8ab94b6c64..f110615831 100755 --- a/direct/src/extensions/OdeSpace-extensions.py +++ b/direct/src/extensions/OdeSpace-extensions.py @@ -21,3 +21,12 @@ def getConvertedSpace(self): """ """ 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 \ No newline at end of file diff --git a/direct/src/extensions_native/OdeGeom_extensions.py b/direct/src/extensions_native/OdeGeom_extensions.py index acadf78e58..2590c45450 100755 --- a/direct/src/extensions_native/OdeGeom_extensions.py +++ b/direct/src/extensions_native/OdeGeom_extensions.py @@ -50,3 +50,15 @@ def getConvertedSpace(self): return self.getSpace().convert() Dtool_funcToMethod(getConvertedSpace, OdeGeom) 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 + diff --git a/direct/src/extensions_native/OdeSpace_extensions.py b/direct/src/extensions_native/OdeSpace_extensions.py index 7dac31b7d1..25337e28cb 100755 --- a/direct/src/extensions_native/OdeSpace_extensions.py +++ b/direct/src/extensions_native/OdeSpace_extensions.py @@ -41,3 +41,14 @@ def getConvertedSpace(self): Dtool_funcToMethod(getConvertedSpace, OdeSpace) 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 + diff --git a/panda/src/ode/odeGeom.I b/panda/src/ode/odeGeom.I index 2b6645c465..77a4145bfc 100755 --- a/panda/src/ode/odeGeom.I +++ b/panda/src/ode/odeGeom.I @@ -83,12 +83,13 @@ get_quaternion() const { return LQuaternionf(res[0], res[1], res[2], res[3]); } -/* 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:: is_space() { diff --git a/panda/src/ode/odeGeom.h b/panda/src/ode/odeGeom.h index 19b2c70d3d..ca92a71934 100755 --- a/panda/src/ode/odeGeom.h +++ b/panda/src/ode/odeGeom.h @@ -82,7 +82,7 @@ PUBLISHED: INLINE LPoint3f get_position() const; INLINE LMatrix3f get_rotation() 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 get_class() const; INLINE void set_category_bits(const BitMask32 &bits); diff --git a/panda/src/ode/odeSpace.I b/panda/src/ode/odeSpace.I index f1a713789e..e1dcb72ded 100755 --- a/panda/src/ode/odeSpace.I +++ b/panda/src/ode/odeSpace.I @@ -42,12 +42,13 @@ get_space() const { return OdeSpace(dGeomGetSpace((dGeomID)_id)); } -/* 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:: is_space() { diff --git a/panda/src/ode/odeSpace.h b/panda/src/ode/odeSpace.h index 06bef41b13..1d3268a609 100755 --- a/panda/src/ode/odeSpace.h +++ b/panda/src/ode/odeSpace.h @@ -51,7 +51,7 @@ PUBLISHED: INLINE int query(const OdeGeom& geom) const; INLINE int query(const OdeSpace& space) 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 get_class() const; INLINE void set_category_bits(const BitMask32 &bits);