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
#ifndef DIME_BOX_H
00031
#define DIME_BOX_H
00032
00033
#include <dime/Basic.h>
00034
#include <dime/util/Linear.h>
00035
00036
class DIME_DLL_API dimeBox
00037 {
00038
public:
00039
dimeVec3f min, max;
00040
public:
00041 dimeBox();
00042 dimeBox(
const dxfdouble x0,
const dxfdouble y0,
const dxfdouble z0,
00043
const dxfdouble x1,
const dxfdouble y1,
const dxfdouble z1);
00044
00045
void set(
const dxfdouble x0,
const dxfdouble y0,
const dxfdouble z0,
00046
const dxfdouble x1,
const dxfdouble y1,
const dxfdouble z1);
00047
00048
void get(dxfdouble &x0, dxfdouble &y0, dxfdouble &z0,
00049 dxfdouble &x1, dxfdouble &y1, dxfdouble &z1)
const;
00050
00051
bool operator & (
const dimeBox &box)
const;
00052
00053
bool pointInside(
const dimeVec3f &pt)
const;
00054
00055
dimeVec3f center() const;
00056
00057
void makeEmpty();
00058
void grow(const
dimeVec3f &pt);
00059 dxfdouble size() const;
00060
bool hasExtent() const;
00061 };
00062
00063 inline
bool
00064 dimeBox::pointInside(const
dimeVec3f &pt)
const
00065
{
00066
return ! (pt[0] < this->min[0] || pt[0] >= this->max[0] ||
00067 pt[1] < this->min[1] || pt[1] >= this->max[1] ||
00068 pt[2] < this->min[2] || pt[2] >= this->max[2]);
00069 }
00070
00071
inline dimeVec3f
00072 dimeBox::center()
const
00073
{
00074
return dimeVec3f((min[0]+max[0])*0.5f,
00075 (min[1]+max[1])*0.5f,
00076 (min[2]+max[2])*0.5f);
00077 }
00078
00079
#endif // ! DIME_BOX_H
00080