From 7a85fdc59abc38b9c5fd28c8f39fbb551d1e03f4 Mon Sep 17 00:00:00 2001 From: castano Date: Wed, 22 Oct 2008 05:32:56 +0000 Subject: [PATCH] Merge fixes from trunk. --- src/nvmath/Box.h | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/src/nvmath/Box.h b/src/nvmath/Box.h index a8426a3..212432d 100644 --- a/src/nvmath/Box.h +++ b/src/nvmath/Box.h @@ -108,7 +108,7 @@ public: float area() const { const Vector3 d = extents(); - return 4.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z()); + return 8.0f * (d.x()*d.y() + d.x()*d.z() + d.y()*d.z()); } /// Get the volume of the box. @@ -118,6 +118,14 @@ public: return 8.0f * (d.x() * d.y() * d.z()); } + /// Return true if the box contains the given point. + bool contains(Vector3::Arg p) const + { + return + m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() && + m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z(); + } + private: Vector3 m_mins; @@ -125,15 +133,6 @@ private: }; -/* -/// Point inside box test. -inline bool pointInsideBox(const Box & b, Vector3::Arg p) const -{ - return (m_mins.x() < p.x() && m_mins.y() < p.y() && m_mins.z() < p.z() && - m_maxs.x() > p.x() && m_maxs.y() > p.y() && m_maxs.z() > p.z()); -} -*/ - } // nv namespace