00001 00015 #ifndef BBOX_H 00016 #define BBOX_H 00017 00018 #include "IS3DCommon.H" 00019 00020 namespace IS3D { 00021 00022 class BBox 00023 { 00024 public: 00025 BBox() { _initialized = false; } 00026 BBox(const AABox &aabox) { 00027 _initialized = false; 00028 _box = aabox; //AABox(aabox.low(),aabox.high()); 00029 } 00030 00031 virtual ~BBox() {} 00032 00033 inline void addPoint(const Vector3 &p) { 00034 if (!_initialized) 00035 _box = AABox(p); 00036 else { 00037 Vector3 low = _box.low().min(p); 00038 Vector3 high = _box.high().max(p); 00039 _box = AABox(low,high); 00040 } 00041 _initialized = true; 00042 } 00043 00044 inline void addAABox(const AABox &b) { 00045 if (!_initialized) 00046 _box = b; 00047 else { 00048 Vector3 low = _box.low().min(b.low()); 00049 Vector3 high = _box.high().max(b.high()); 00050 _box = AABox(low,high); 00051 } 00052 _initialized = true; 00053 } 00054 00055 inline void addBBox(const BBox &b) { 00056 addAABox(b.getAABox()); 00057 } 00058 00059 inline AABox getAABox() const { return _box; } 00060 00061 inline bool getInitialized() const { return _initialized; } 00062 00063 protected: 00064 bool _initialized; 00065 AABox _box; 00066 }; 00067 00068 } // end namespace 00069 00070 #endif