Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TAttBBox.cxx
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
13#include "TAttBBox.h"
14
15/** \class TAttBBox
16\ingroup Base
17\ingroup GraphicsAtt
18
19Helper for management of bounding-box information.
20Optionally used by classes that use direct OpenGL rendering
21via `<Class>GL class`.
22*/
23
24
25////////////////////////////////////////////////////////////////////////////////
26/// Allocate and prepare for incremental filling.
27
29{
30 if (fBBox == nullptr) fBBox = new Float_t[6];
31
32 fBBox[0] = infinity; fBBox[1] = -infinity;
33 fBBox[2] = infinity; fBBox[3] = -infinity;
34 fBBox[4] = infinity; fBBox[5] = -infinity;
35}
36
37////////////////////////////////////////////////////////////////////////////////
38/// Create cube of volume (2*epsilon)^3 at (x,y,z).
39/// epsilon is zero by default.
40
42{
43 if (fBBox == nullptr) fBBox = new Float_t[6];
44
45 fBBox[0] = x - epsilon; fBBox[1] = x + epsilon;
46 fBBox[2] = y - epsilon; fBBox[3] = y + epsilon;
47 fBBox[4] = z - epsilon; fBBox[5] = z + epsilon;
48}
49
50////////////////////////////////////////////////////////////////////////////////
51/// Remove BBox information.
52
54{
55 delete [] fBBox; fBBox = nullptr;
56}
57
58////////////////////////////////////////////////////////////////////////////////
59/// Assert extents of all sides of the bounding-box are at least epsilon.
60
62{
63 for (Int_t i=0; i<6; i+=2) {
64 if (fBBox[i+1] - fBBox[i] < epsilon) {
65 Float_t b = 0.5*(fBBox[i] + fBBox[i+1]);
66 fBBox[i] = b - 0.5*epsilon;
67 fBBox[i+1] = b + 0.5*epsilon;
68 }
69 }
70}
71
72////////////////////////////////////////////////////////////////////////////////
73/// Setup bounding box as cube with given extent and center position.
74
#define b(i)
Definition RSha256.hxx:100
float Float_t
Float 4 bytes (float)
Definition RtypesCore.h:71
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:75
void BBoxClear()
Remove BBox information.
Definition TAttBBox.cxx:53
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:41
void AssertBBoxExtents(Float_t epsilon=0.005)
Assert extents of all sides of the bounding-box are at least epsilon.
Definition TAttBBox.cxx:61
void BBoxInit(Float_t infinity=1e6)
Dynamic Float_t[6] X(min,max), Y(min,max), Z(min,max)
Definition TAttBBox.cxx:28
Float_t * fBBox
Definition TAttBBox.h:20
Double_t y[n]
Definition legend1.C:17
Double_t x[n]
Definition legend1.C:17