00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __CBOUNDING_BOX3D_H
00028 #define __CBOUNDING_BOX3D_H
00029
00030
00031
00033
00034
00036
00037
00039
00040 #include "CP4D.h"
00041
00042
00048 class CBoundingBox3D {
00049 public:
00050
00052
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
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
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 };
00187
00188 #endif // __CBOUNDING_BOX_H