Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

CBoundingBox3D.h

Go to the documentation of this file.
00001 /*
00002  * CBoundingBox3D.h
00003  * $Id: CBoundingBox3D.h,v 1.3 2001/09/28 11:06:08 mjanich Exp $
00004  *
00005  * Copyright (C) 1999, 2000 Rainer Jaeger, Michael Meissner
00006  *
00007  * This program is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License as published by
00009  * the Free Software Foundation; either version 2 of the License, or
00010  * (at your option) any later version.
00011  *
00012  * This program is distributed in the hope that it will be useful,
00013  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU General Public License
00018  * along with this program; if not, write to the Free Software
00019  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00020  *
00021  */
00022 
00023 //  Description : Class CBoundingBox3D
00024 //  Purpose     : Provides  funcionality
00025 
00026 
00027 #ifndef __CBOUNDING_BOX3D_H
00028 #define __CBOUNDING_BOX3D_H
00029 
00030 
00031 // Qt
00033 
00034 // System
00036 
00037 // Own
00039 #include "CP3D.h"
00040 #include "CP4D.h"
00041 
00042 
00048 class CBoundingBox3D {
00049  public:
00050 
00052   // CONSTRUCTORS //
00054 
00056   CBoundingBox3D(void) { m_LowerLeft = CP3D(0.0, 0.0, 0.0);
00057                        m_UpperRight = CP3D(0.0, 0.0, 0.0); };
00058 
00062   CBoundingBox3D(double, double, double, double, double, double);
00063 
00067   CBoundingBox3D(const CP3D &minVec, const CP3D &maxVec);
00068 
00072   CBoundingBox3D(const CP4D &minVec, const CP4D &maxVec);
00073 
00075   CBoundingBox3D(const CBoundingBox3D &bbox);
00076 
00078   void CommonConstructor(CP3D, CP3D); 
00079 
00081   ~CBoundingBox3D();
00082 
00083 
00084   static double epsilon;
00085 
00087   // MEMBER FUNCTIONS //
00089 
00091    void setBBox(CBoundingBox3D &bbox);
00092 
00094    const CBoundingBox3D& operator=(const CBoundingBox3D& bbox);
00095 
00097    CBoundingBox3D operator+(const CBoundingBox3D& bbox) const;
00098 
00100    CBoundingBox3D& operator+=(const CBoundingBox3D& bbox);
00101 
00104    void addPoint(const CP3D&);
00105 
00108    void addPoint(const CP4D&);
00109 
00111    void move(const CV3D&);
00112 
00116    void scale(const CV3D&);
00117 
00119   CP3D getLowerLeft() const  { return m_LowerLeft; }
00120 
00122   CP3D getUpperRight() const { return m_UpperRight; }
00123 
00126   CP3D getCornerVertex(int) const;
00127 
00129   double getSize(int) const;
00130 
00132   double getMinSize(void) const;
00133 
00135   double getMaxSize(void) const;
00136 
00138   const CP3D getCenter(void) const;
00139 
00141   double getCenter(int nDimension) { return 0.5 * (m_UpperRight[nDimension] 
00142                                                    + m_LowerLeft[nDimension]); };
00143 
00145   double getOuterRadius(void) const { return 0.5 * sqrt(3*getMaxSize()*getMaxSize()); };  
00146 
00148   double getInnerRadius(void) const { return 0.5 * sqrt(3*getMinSize()*getMinSize()); };
00149 
00151   double getDiagonal(void) const;
00152 
00154   double getVolume(void) const;
00155 
00157   bool isInside(const CP3D&) const;
00158 
00160   bool isInside(const CP4D&) const;
00161 
00163   bool operator==(const CBoundingBox3D &cSource) const {
00164     return (m_LowerLeft == cSource.m_LowerLeft) &&
00165            (m_UpperRight == cSource.m_UpperRight);
00166   };
00167 
00168 
00170   // HELPER FUNCTIONS //
00172 
00174   void print(void) const;
00175 
00177   friend ostream& operator<<(ostream&, const CBoundingBox3D&);
00178 
00180   friend istream& operator>>(istream&, CBoundingBox3D&);
00181 
00182 protected:
00183   CP3D m_LowerLeft;
00184   CP3D m_UpperRight;
00185 
00186 }; // class CBoundingBox3D
00187 
00188 #endif // __CBOUNDING_BOX_H

Generated at Thu Oct 4 17:17:24 2001 for QGLViewer by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001