00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TAttBBox
00013 #define ROOT_TAttBBox
00014
00015 #ifndef ROOT_Rtypes
00016 #include "Rtypes.h"
00017 #endif
00018
00019 class TAttBBox
00020 {
00021 protected:
00022 Float_t* fBBox;
00023
00024 void BBoxInit(Float_t infinity=1e6);
00025 void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0);
00026 void BBoxClear();
00027
00028 void BBoxCheckPoint(Float_t x, Float_t y, Float_t z);
00029 void BBoxCheckPoint(const Float_t* p);
00030
00031 void AssertBBoxExtents(Float_t epsilon=0.005);
00032
00033 TAttBBox(const TAttBBox& tab) : fBBox(0) {
00034 BBoxInit(); if(tab.fBBox) for(Int_t i=0; i<6; i++) fBBox[i]=tab.fBBox[i];
00035 }
00036
00037 public:
00038 TAttBBox(): fBBox(0) { }
00039 virtual ~TAttBBox() { BBoxClear(); }
00040
00041 TAttBBox& operator=(const TAttBBox& tab)
00042 {if(this!=&tab) {BBoxInit(); if(tab.fBBox) for(Int_t i=0; i<6; i++) fBBox[i]=tab.fBBox[i];}
00043 return *this;}
00044
00045 Bool_t GetBBoxOK() const { return fBBox != 0; }
00046 Float_t* GetBBox() { return fBBox; }
00047 Float_t* AssertBBox() { if(fBBox == 0) ComputeBBox(); return fBBox; }
00048 void ResetBBox() { if(fBBox != 0) BBoxClear(); }
00049
00050 virtual void ComputeBBox() = 0;
00051
00052 ClassDef(TAttBBox,1);
00053 };
00054
00055
00056
00057
00058 inline void TAttBBox::BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
00059 {
00060 if(x < fBBox[0]) fBBox[0] = x; if(x > fBBox[1]) fBBox[1] = x;
00061 if(y < fBBox[2]) fBBox[2] = y; if(y > fBBox[3]) fBBox[3] = y;
00062 if(z < fBBox[4]) fBBox[4] = z; if(z > fBBox[5]) fBBox[5] = z;
00063 }
00064
00065 inline void TAttBBox::BBoxCheckPoint(const Float_t* p)
00066 {
00067 BBoxCheckPoint(p[0], p[1], p[2]);
00068 }
00069
00070 #endif