Logo ROOT   6.18/05
Reference Guide
TAttBBox.h
Go to the documentation of this file.
1// @(#)root/base:$Id$
2// Author: Matevz Tadel 7/4/2006
3
4/*************************************************************************
5 * Copyright (C) 1995-2006, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_TAttBBox
13#define ROOT_TAttBBox
14
15#include "Rtypes.h"
16
18{
19protected:
20 Float_t* fBBox; //! Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
21
22 void BBoxInit(Float_t infinity=1e6);
23 void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0);
24 void BBoxClear();
25
27 void BBoxCheckPoint(const Float_t* p);
28
30
31 TAttBBox(const TAttBBox& tab) : fBBox(0) {
32 BBoxInit(); if(tab.fBBox) for(Int_t i=0; i<6; i++) fBBox[i]=tab.fBBox[i];
33 }
34
35public:
36 TAttBBox(): fBBox(0) { }
37 virtual ~TAttBBox() { BBoxClear(); }
38
40 {if(this!=&tab) {BBoxInit(); if(tab.fBBox) for(Int_t i=0; i<6; i++) fBBox[i]=tab.fBBox[i];}
41 return *this;}
42
43 Bool_t GetBBoxOK() const { return fBBox != 0; }
44 Float_t* GetBBox() { return fBBox; }
45 Float_t* AssertBBox() { if(fBBox == 0) ComputeBBox(); return fBBox; }
46 void ResetBBox() { if(fBBox != 0) BBoxClear(); }
47
48 void SetupBBoxCube(Float_t extent, Float_t x, Float_t y, Float_t z);
49
50 virtual void ComputeBBox() = 0;
51
52 ClassDef(TAttBBox,1); // Helper for management of bounding-box information
53};
54
55
56// Inline methods:
57
59{
60 if(x < fBBox[0]) fBBox[0] = x;
61 if(x > fBBox[1]) fBBox[1] = x;
62 if(y < fBBox[2]) fBBox[2] = y;
63 if(y > fBBox[3]) fBBox[3] = y;
64 if(z < fBBox[4]) fBBox[4] = z;
65 if(z > fBBox[5]) fBBox[5] = z;
66}
67
68inline void TAttBBox::BBoxCheckPoint(const Float_t* p)
69{
70 BBoxCheckPoint(p[0], p[1], p[2]);
71}
72
73#endif
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
float Float_t
Definition: RtypesCore.h:53
#define ClassDef(name, id)
Definition: Rtypes.h:326
Helper for management of bounding-box information.
Definition: TAttBBox.h:18
virtual void ComputeBBox()=0
void SetupBBoxCube(Float_t extent, Float_t x, Float_t y, Float_t z)
Setup bounding box as cube with given extent and center position.
Definition: TAttBBox.cxx:76
void BBoxClear()
Remove BBox information.
Definition: TAttBBox.cxx:54
virtual ~TAttBBox()
Definition: TAttBBox.h:37
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
Definition: TAttBBox.h:58
Bool_t GetBBoxOK() const
Definition: TAttBBox.h:43
void ResetBBox()
Definition: TAttBBox.h:46
void BBoxZero(Float_t epsilon=0, Float_t x=0, Float_t y=0, Float_t z=0)
Create cube of volume (2*epsilon)^3 at (x,y,z).
Definition: TAttBBox.cxx:42
TAttBBox & operator=(const TAttBBox &tab)
Definition: TAttBBox.h:39
void AssertBBoxExtents(Float_t epsilon=0.005)
Assert extents of all sides of the bounding-box are at least epsilon.
Definition: TAttBBox.cxx:62
Float_t * GetBBox()
Definition: TAttBBox.h:44
Float_t * AssertBBox()
Definition: TAttBBox.h:45
TAttBBox()
Definition: TAttBBox.h:36
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
Definition: TAttBBox.cxx:29
Float_t * fBBox
Definition: TAttBBox.h:20
TAttBBox(const TAttBBox &tab)
Definition: TAttBBox.h:31
Double_t y[n]
Definition: legend1.C:17
Double_t x[n]
Definition: legend1.C:17
REAL epsilon
Definition: triangle.c:617