Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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
29 void AssertBBoxExtents(Float_t epsilon=0.005);
30
31 TAttBBox(const TAttBBox &tab) : fBBox(nullptr)
32 {
33 BBoxInit();
34 if (tab.fBBox)
35 for (Int_t i = 0; i < 6; i++)
36 fBBox[i] = tab.fBBox[i];
37 }
38
39public:
40 TAttBBox(): fBBox(nullptr) { }
41 virtual ~TAttBBox() { BBoxClear(); }
42
44 {
45 if (this != &tab) {
46 BBoxInit();
47 if (tab.fBBox)
48 for (Int_t i = 0; i < 6; i++)
49 fBBox[i] = tab.fBBox[i];
50 }
51 return *this;
52 }
53
54 Bool_t GetBBoxOK() const { return fBBox != nullptr; }
55 Float_t* GetBBox() { return fBBox; }
56 Float_t* AssertBBox() { if(!fBBox) ComputeBBox(); return fBBox; }
57 void ResetBBox() { if(fBBox) BBoxClear(); }
58
59 void SetupBBoxCube(Float_t extent, Float_t x, Float_t y, Float_t z);
60
61 virtual void ComputeBBox() = 0;
62
63 ClassDef(TAttBBox,1); // Helper for management of bounding-box information
64};
65
66
67// Inline methods:
68
70{
71 if(x < fBBox[0]) fBBox[0] = x;
72 if(x > fBBox[1]) fBBox[1] = x;
73 if(y < fBBox[2]) fBBox[2] = y;
74 if(y > fBBox[3]) fBBox[3] = y;
75 if(z < fBBox[4]) fBBox[4] = z;
76 if(z > fBBox[5]) fBBox[5] = z;
77}
78
80{
81 BBoxCheckPoint(p[0], p[1], p[2]);
82}
83
84#endif
float Float_t
Definition RtypesCore.h:57
#define ClassDef(name, id)
Definition Rtypes.h:337
winID h TVirtualViewer3D TVirtualGLPainter p
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:41
void BBoxCheckPoint(Float_t x, Float_t y, Float_t z)
Definition TAttBBox.h:69
Bool_t GetBBoxOK() const
Definition TAttBBox.h:54
void ResetBBox()
Definition TAttBBox.h:57
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:43
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:55
Float_t * AssertBBox()
Definition TAttBBox.h:56
TAttBBox()
Definition TAttBBox.h:40
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