File indexing completed on 2025-01-18 10:11:30
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TAttBBox
0013 #define ROOT_TAttBBox
0014
0015 #include "Rtypes.h"
0016
0017 class TAttBBox
0018 {
0019 protected:
0020 Float_t* fBBox;
0021
0022 void BBoxInit(Float_t infinity=1e6);
0023 void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0);
0024 void BBoxClear();
0025
0026 void BBoxCheckPoint(Float_t x, Float_t y, Float_t z);
0027 void BBoxCheckPoint(const Float_t* p);
0028
0029 void AssertBBoxExtents(Float_t epsilon=0.005);
0030
0031 TAttBBox(const TAttBBox &tab) : fBBox(nullptr)
0032 {
0033 BBoxInit();
0034 if (tab.fBBox)
0035 for (Int_t i = 0; i < 6; i++)
0036 fBBox[i] = tab.fBBox[i];
0037 }
0038
0039 public:
0040 TAttBBox(): fBBox(nullptr) { }
0041 virtual ~TAttBBox() { BBoxClear(); }
0042
0043 TAttBBox &operator=(const TAttBBox &tab)
0044 {
0045 if (this != &tab) {
0046 BBoxInit();
0047 if (tab.fBBox)
0048 for (Int_t i = 0; i < 6; i++)
0049 fBBox[i] = tab.fBBox[i];
0050 }
0051 return *this;
0052 }
0053
0054 Bool_t GetBBoxOK() const { return fBBox != nullptr; }
0055 Float_t* GetBBox() { return fBBox; }
0056 Float_t* AssertBBox() { if(!fBBox) ComputeBBox(); return fBBox; }
0057 void ResetBBox() { if(fBBox) BBoxClear(); }
0058
0059 void SetupBBoxCube(Float_t extent, Float_t x, Float_t y, Float_t z);
0060
0061 virtual void ComputeBBox() = 0;
0062
0063 ClassDef(TAttBBox,1);
0064 };
0065
0066
0067
0068
0069 inline void TAttBBox::BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
0070 {
0071 if(x < fBBox[0]) fBBox[0] = x;
0072 if(x > fBBox[1]) fBBox[1] = x;
0073 if(y < fBBox[2]) fBBox[2] = y;
0074 if(y > fBBox[3]) fBBox[3] = y;
0075 if(z < fBBox[4]) fBBox[4] = z;
0076 if(z > fBBox[5]) fBBox[5] = z;
0077 }
0078
0079 inline void TAttBBox::BBoxCheckPoint(const Float_t* p)
0080 {
0081 BBoxCheckPoint(p[0], p[1], p[2]);
0082 }
0083
0084 #endif