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
00028
00029
00030
00031
00032
00033
00034
#ifndef __CBOUNDING_BOX3D_H
00035
#define __CBOUNDING_BOX3D_H
00036
00037
00038
00040
00041
00043
00044
00046
#include "CP3D.h"
00047
#include "CP4D.h"
00048
00049
00055 class CBoundingBox3D {
00056
public:
00057
00059
00061
00063 CBoundingBox3D(
void) {
m_LowerLeft =
CP3D(0.0, 0.0, 0.0);
00064
m_UpperRight = CP3D(0.0, 0.0, 0.0); };
00065
00069
CBoundingBox3D(
double,
double,
double,
double,
double,
double);
00070
00074
CBoundingBox3D(
const CP3D &minVec,
const CP3D &maxVec);
00075
00079
CBoundingBox3D(
const CP4D &minVec,
const CP4D &maxVec);
00080
00082
CBoundingBox3D(
const CBoundingBox3D &bbox);
00083
00085
void CommonConstructor(
CP3D,
CP3D);
00086
00088
~CBoundingBox3D();
00089
00090
00091
static double epsilon;
00092
00094
00096
00098
void setBBox(
CBoundingBox3D &bbox);
00099
00101
const CBoundingBox3D& operator=(
const CBoundingBox3D& bbox);
00102
00104
CBoundingBox3D operator+(
const CBoundingBox3D& bbox)
const;
00105
00107
CBoundingBox3D& operator+=(
const CBoundingBox3D& bbox);
00108
00111
void addPoint(
const CP3D&);
00112
00115
void addPoint(
const CP4D&);
00116
00118
void move(
const CV3D&);
00119
00123
void scale(
const CV3D&);
00124
00126 CP3D getLowerLeft()
const {
return m_LowerLeft; }
00127
00129 CP3D getUpperRight()
const {
return m_UpperRight; }
00130
00133
CP3D getCornerVertex(
int) const;
00134
00136
double getSize(
int) const;
00137
00139
double getMinSize(
void) const;
00140
00142
double getMaxSize(
void) const;
00143
00145 const
CP3D getCenter(
void) const;
00146
00148 double getCenter(
int nDimension) {
return 0.5 * (
m_UpperRight[nDimension]
00149 +
m_LowerLeft[nDimension]); };
00150
00152 double getOuterRadius(
void)
const {
return 0.5 * sqrt(3*
getMaxSize()*
getMaxSize()); };
00153
00155 double getInnerRadius(
void)
const {
return 0.5 * sqrt(3*
getMinSize()*
getMinSize()); };
00156
00158
double getDiagonal(
void) const;
00159
00161
double getVolume(
void) const;
00162
00164
bool isInside(const
CP3D&) const;
00165
00167
bool isInside(const
CP4D&) const;
00168
00170 bool operator==(const
CBoundingBox3D &cSource)
const {
00171
return (
m_LowerLeft == cSource.m_LowerLeft) &&
00172 (
m_UpperRight == cSource.m_UpperRight);
00173 };
00174
00175
00177
00179
00181
void print(
void) const;
00182
00184 friend ::ostream& operator<<(::ostream&, const
CBoundingBox3D&);
00185
00187 friend ::istream& operator>>(::istream&, CBoundingBox3D&);
00188
00189 protected:
00190 CP3D m_LowerLeft;
00191 CP3D m_UpperRight;
00192
00193 };
00194
00195 #endif