glc_boundingbox.h

Go to the documentation of this file.
00001 /****************************************************************************
00002 
00003  This file is part of the GLC-lib library.
00004  Copyright (C) 2005-2008 Laurent Ribon (laumaya@users.sourceforge.net)
00005  Version 1.2.0, packaged on September 2009.
00006 
00007  http://glc-lib.sourceforge.net
00008 
00009  GLC-lib is free software; you can redistribute it and/or modify
00010  it under the terms of the GNU General Public License as published by
00011  the Free Software Foundation; either version 2 of the License, or
00012  (at your option) any later version.
00013 
00014  GLC-lib is distributed in the hope that it will be useful,
00015  but WITHOUT ANY WARRANTY; without even the implied warranty of
00016  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00017  GNU General Public License for more details.
00018 
00019  You should have received a copy of the GNU General Public License
00020  along with GLC-lib; if not, write to the Free Software
00021  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00022 
00023 *****************************************************************************/
00024 
00026 
00027 #ifndef GLC_BOUNDINGBOX_
00028 #define GLC_BOUNDINGBOX_
00029 
00030 #include "maths/glc_vector4d.h"
00031 #include "maths/glc_utils_maths.h"
00032 #include "maths/glc_matrix4x4.h"
00033 
00036 
00041 
00042 
00043 class GLC_BoundingBox
00044 {
00046 
00048 
00049 public:
00051         GLC_BoundingBox();
00052 
00054         GLC_BoundingBox(const GLC_BoundingBox& boundingBox);
00055 
00057         GLC_BoundingBox(const GLC_Point4d& lower, const GLC_Point4d& upper);
00058 
00060 
00061 
00063 
00064 
00066         bool isEmpty(void) const
00067         {
00068                 return m_IsEmpty;
00069         }
00070 
00072         bool intersect(const GLC_Point4d& point) const;
00073 
00075         bool intersectBoundingSphere(const GLC_Point4d&) const;
00076 
00078         //double maxDistance(const GLC_Vector4d& point) const;
00079 
00081         GLC_Point4d lowerCorner(void) const;
00082 
00084         GLC_Point4d upperCorner(void) const;
00085 
00087         GLC_Point4d center(void) const;
00088 
00090         inline double boundingSphereRadius() const
00091         {return GLC_Vector4d(m_Lower - m_Upper).norm() / 2.0;}
00092 
00094 
00096 
00098 
00099 public:
00101         GLC_BoundingBox& combine(const GLC_Point4d& point);
00102 
00104         GLC_BoundingBox& combine(const GLC_Point3d& point);
00105 
00107         GLC_BoundingBox& combine(const GLC_Point3df& point);
00108 
00110         GLC_BoundingBox& combine(const GLC_BoundingBox& box);
00111 
00113         GLC_BoundingBox& transform(const GLC_Matrix4x4& matrix);
00114 
00115 
00117 
00118 
00120 // Private members
00122 private:
00123         GLC_Point4d m_Lower;
00124         GLC_Point4d m_Upper;
00125         bool m_IsEmpty;
00126 
00127 };
00128 #endif /*GLC_BOUNDINGBOX_*/

SourceForge.net Logo

©2005 Laurent Ribon