Logo ROOT  
Reference Guide
TBuffer3D.h
Go to the documentation of this file.
1 // @(#)root/base:$Id: TBuffer3D.h,v 1.00
2 // Author: Olivier Couet 05/05/04
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2004, 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_TBuffer3D
13 #define ROOT_TBuffer3D
14 
15 #include "TObject.h"
16 
17 class TBuffer3D : public TObject
18 {
19 private:
20  const Int_t fType; // Primitive type - predefined ones in TBuffer3DTypes.h
21 
22  UInt_t fNbPnts; // Number of points describing the shape
23  UInt_t fNbSegs; // Number of segments describing the shape
24  UInt_t fNbPols; // Number of polygons describing the shape
25 
26  UInt_t fPntsCapacity; // Current capacity of fPnts space
27  UInt_t fSegsCapacity; // Current capacity of fSegs space
28  UInt_t fPolsCapacity; // Current capacity of fSegs space
29 
30  UInt_t fSections; // Section validity flags
31 
32  void Init();
33 
34  // Non-copyable class
35  TBuffer3D(const TBuffer3D &) = delete;
36  TBuffer3D & operator=(const TBuffer3D &) = delete;
37 
38  //CS specific
39  static UInt_t fgCSLevel;
40 
41 public:
42  //CS specific
44 
45  static UInt_t GetCSLevel();
46  static void IncCSLevel();
47  static UInt_t DecCSLevel();
48 
49  enum ESection { kNone = BIT(0),
50  kCore = BIT(1),
51  kBoundingBox = BIT(2),
52  kShapeSpecific = BIT(3),
53  kRawSizes = BIT(4),
54  kRaw = BIT(5),
56  };
57 
59  UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
60  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
61  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
62  virtual ~TBuffer3D();
63 
64  // Section validity flags
65  void SetSectionsValid(UInt_t mask) { fSections |= mask & kAll; }
66  void ClearSectionsValid();
67  Bool_t SectionsValid(UInt_t mask) const { return (Bool_t) (GetSections(mask) == mask); }
68  UInt_t GetSections(UInt_t mask) const { return (UInt_t) (fSections & mask); }
69 
70  // Convenience functions
71  void SetLocalMasterIdentity(); // Set fLocalMaster in kCore to identity
72  void SetAABoundingBox(const Double_t origin[3], // Set fBBVertex in kBoundingBox to axis aligned BB
73  const Double_t halfLengths[3]);
74 
75  // SECTION: kRawSize get/set
76  Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity,
77  UInt_t reqSegs, UInt_t reqSegsCapacity,
78  UInt_t reqPols, UInt_t reqPolsCapacity);
79 
80  UInt_t NbPnts() const { return fNbPnts; }
81  UInt_t NbSegs() const { return fNbSegs; }
82  UInt_t NbPols() const { return fNbPols; }
83 
84  // SECTION: kCore
85  Int_t Type() const { return fType; }
86 
87  TObject *fID; // ID/object generating buffer - see TVirtualViewer3D for setting
88  Int_t fColor; // Color index
89  Short_t fTransparency; // Percentage transparency [0,100]
90  Bool_t fLocalFrame; // True = Local, False = Master reference frame
91  Bool_t fReflection; // Matrix is reflection
92  Double_t fLocalMaster[16]; // Local->Master Matrix - identity if master frame
93 
94  // SECTION: kBoundingBox
95  //
96  // Local frame (fLocalFrame true) axis aligned
97  // Master frame (fLocalFrame false) oriented
98  // Could be more compact (2 and 3 vertices respectively) and rest
99  // calculated as needed - but not worth it
100  // 7-------6
101  // /| /|
102  // 3-------2 |
103  // | 4-----|-5
104  // |/ |/
105  // 0-------1
106  //
107  Double_t fBBVertex[8][3]; // 8 vertices defining bounding box.
108 
109  // SECTION: kShapeSpecific - none for base class
110 
111  // SECTION: kRaw
112  Double_t *fPnts; // x0, y0, z0, x1, y1, z1, ..... ..... ....
113  Int_t *fSegs; // c0, p0, q0, c1, p1, q1, ..... ..... ....
114  Int_t *fPols; // c0, n0, s0, s1, ... sn, c1, n1, s0, ... sn
115 
116 
117  // OUTPUT SECTION, filled by viewer as response
118  mutable UInt_t fPhysicalID; // Unique replica ID.
119 
120 
121  ClassDef(TBuffer3D,0) // 3D primitives description
122 };
123 
124 /** \class TBuffer3DSphere
125 Sphere description class - see TBuffer3DTypes for producer classes
126 Supports hollow and cut spheres.*/
127 
129 {
130 private:
131  // Non-copyable class
132  TBuffer3DSphere(const TBuffer3DSphere &) = delete;
133  TBuffer3DSphere & operator=(const TBuffer3DSphere &) = delete;
134 
135 public:
136  TBuffer3DSphere(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
137  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
138  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
139 
140  Bool_t IsSolidUncut() const;
141 
142  // SECTION: kShapeSpecific
145  Double_t fThetaMin; // Lower theta limit (orientation?)
146  Double_t fThetaMax; // Higher theta limit (orientation?)
147  Double_t fPhiMin; // Lower phi limit (orientation?)
148  Double_t fPhiMax; // Higher phi limit (orientation?)
149 };
150 
151 /** \class TBuffer3DTube
152 Complete tube description class - see TBuffer3DTypes for producer classes
153 */
154 
155 class TBuffer3DTube : public TBuffer3D
156 {
157 private:
158  // Non-copyable class
159  TBuffer3DTube(const TBuffer3DTube &) = delete;
160  TBuffer3DTube & operator=(const TBuffer3DTube &) = delete;
161 
162 protected:
164  UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
165  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
166  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
167 
168 public:
169  TBuffer3DTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
170  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
171  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
172 
173  // SECTION: kShapeSpecific
174  Double_t fRadiusInner; // Inner radius
175  Double_t fRadiusOuter; // Outer radius
176  Double_t fHalfLength; // Half length (dz)
177 };
178 
179 /** \class TBuffer3DTubeSeg
180 Tube segment description class - see TBuffer3DTypes for producer classes
181 */
182 
184 {
185 private:
186  // Non-copyable class
188  TBuffer3DTubeSeg & operator=(const TBuffer3DTubeSeg &) = delete;
189 
190 protected:
192  UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
193  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
194  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
195 
196 public:
197  TBuffer3DTubeSeg(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
198  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
199  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
200 
201  // SECTION: kShapeSpecific
202  Double_t fPhiMin; // Lower phi limit
203  Double_t fPhiMax; // Higher phi limit
204 };
205 
206 /** \class TBuffer3DCutTube
207 Cut tube segment description class - see TBuffer3DTypes for producer classes
208 */
209 
211 {
212 private:
213  // Non-copyable class
214  TBuffer3DCutTube(const TBuffer3DTubeSeg &) = delete;
215  TBuffer3DCutTube & operator=(const TBuffer3DTubeSeg &) = delete;
216 
217 public:
218  TBuffer3DCutTube(UInt_t reqPnts = 0, UInt_t reqPntsCapacity = 0,
219  UInt_t reqSegs = 0, UInt_t reqSegsCapacity = 0,
220  UInt_t reqPols = 0, UInt_t reqPolsCapacity = 0);
221 
222  // SECTION: kShapeSpecific
223  Double_t fLowPlaneNorm[3]; // Normal to lower cut plane
224  Double_t fHighPlaneNorm[3]; // Normal to highest cut plane
225 };
226 
227 #endif
TBuffer3DSphere::IsSolidUncut
Bool_t IsSolidUncut() const
Test if buffer represents a solid uncut sphere.
Definition: TBuffer3D.cxx:419
TBuffer3DCutTube::operator=
TBuffer3DCutTube & operator=(const TBuffer3DTubeSeg &)=delete
TBuffer3DCutTube
Definition: TBuffer3D.h:210
TBuffer3D::kNone
@ kNone
Definition: TBuffer3D.h:55
TBuffer3D::SectionsValid
Bool_t SectionsValid(UInt_t mask) const
Definition: TBuffer3D.h:73
TBuffer3D::SetSectionsValid
void SetSectionsValid(UInt_t mask)
Definition: TBuffer3D.h:71
TBuffer3D::operator=
TBuffer3D & operator=(const TBuffer3D &)=delete
TBuffer3D::GetSections
UInt_t GetSections(UInt_t mask) const
Definition: TBuffer3D.h:74
TBuffer3DTube
Definition: TBuffer3D.h:155
TBuffer3DSphere::fPhiMin
Double_t fPhiMin
Definition: TBuffer3D.h:147
TBuffer3D::DecCSLevel
static UInt_t DecCSLevel()
Decrement CS level.
Definition: TBuffer3D.cxx:512
TBuffer3D::fPntsCapacity
UInt_t fPntsCapacity
Definition: TBuffer3D.h:32
TBuffer3DSphere::fRadiusInner
Double_t fRadiusInner
Definition: TBuffer3D.h:143
TBuffer3D::SetAABoundingBox
void SetAABoundingBox(const Double_t origin[3], const Double_t halfLengths[3])
Set fBBVertex in kBoundingBox section to a axis aligned (local) BB using supplied origin and box half...
Definition: TBuffer3D.cxx:320
Int_t
int Int_t
Definition: RtypesCore.h:45
TBuffer3D::kCSDifference
@ kCSDifference
Definition: TBuffer3D.h:49
TBuffer3DTubeSeg::TBuffer3DTubeSeg
TBuffer3DTubeSeg(const TBuffer3DTubeSeg &)
TBuffer3D::NbPnts
UInt_t NbPnts() const
Definition: TBuffer3D.h:86
TBuffer3D::kCSUnion
@ kCSUnion
Definition: TBuffer3D.h:49
TBuffer3D::SetRawSizes
Bool_t SetRawSizes(UInt_t reqPnts, UInt_t reqPntsCapacity, UInt_t reqSegs, UInt_t reqSegsCapacity, UInt_t reqPols, UInt_t reqPolsCapacity)
Set kRaw tessellation section of buffer with supplied sizes.
Definition: TBuffer3D.cxx:359
TBuffer3D::SetLocalMasterIdentity
void SetLocalMasterIdentity()
Set kRaw tessellation section of buffer with supplied sizes.
Definition: TBuffer3D.cxx:296
TBuffer3D::fSegs
Int_t * fSegs
Definition: TBuffer3D.h:119
TBuffer3DSphere::fThetaMax
Double_t fThetaMax
Definition: TBuffer3D.h:146
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TBuffer3D::fNbSegs
UInt_t fNbSegs
Definition: TBuffer3D.h:29
TBuffer3DTube::fRadiusOuter
Double_t fRadiusOuter
Definition: TBuffer3D.h:175
TBuffer3DTubeSeg::fPhiMin
Double_t fPhiMin
Definition: TBuffer3D.h:202
bool
TBuffer3D::kShapeSpecific
@ kShapeSpecific
Definition: TBuffer3D.h:58
TBuffer3DTube::fHalfLength
Double_t fHalfLength
Definition: TBuffer3D.h:176
TBuffer3D::kBoundingBox
@ kBoundingBox
Definition: TBuffer3D.h:57
TBuffer3DSphere::fPhiMax
Double_t fPhiMax
Definition: TBuffer3D.h:148
TBuffer3D
Definition: TBuffer3D.h:17
TBuffer3DCutTube::fLowPlaneNorm
Double_t fLowPlaneNorm[3]
Definition: TBuffer3D.h:223
TBuffer3DTubeSeg::fPhiMax
Double_t fPhiMax
Definition: TBuffer3D.h:203
TBuffer3D::fColor
Int_t fColor
Definition: TBuffer3D.h:94
TBuffer3D::fLocalMaster
Double_t fLocalMaster[16]
Definition: TBuffer3D.h:98
TBuffer3D::fSections
UInt_t fSections
Definition: TBuffer3D.h:36
TBuffer3DTube::operator=
TBuffer3DTube & operator=(const TBuffer3DTube &)=delete
TBuffer3DSphere::TBuffer3DSphere
TBuffer3DSphere(const TBuffer3DSphere &)=delete
TBuffer3DCutTube::TBuffer3DCutTube
TBuffer3DCutTube(const TBuffer3DTubeSeg &)=delete
TBuffer3D::fType
const Int_t fType
Definition: TBuffer3D.h:26
TBuffer3DSphere::fThetaMin
Double_t fThetaMin
Definition: TBuffer3D.h:145
TBuffer3DSphere
Definition: TBuffer3D.h:128
TBuffer3DCutTube::fHighPlaneNorm
Double_t fHighPlaneNorm[3]
Definition: TBuffer3D.h:224
BIT
#define BIT(n)
Definition: Rtypes.h:85
TBuffer3D::kRaw
@ kRaw
Definition: TBuffer3D.h:60
UInt_t
unsigned int UInt_t
Definition: RtypesCore.h:46
TBuffer3D::fReflection
Bool_t fReflection
Definition: TBuffer3D.h:97
TBuffer3DTube::TBuffer3DTube
TBuffer3DTube(const TBuffer3DTube &)=delete
Short_t
short Short_t
Definition: RtypesCore.h:39
TBuffer3D::fTransparency
Short_t fTransparency
Definition: TBuffer3D.h:95
TBuffer3DTubeSeg::operator=
TBuffer3DTubeSeg & operator=(const TBuffer3DTubeSeg &)=delete
TBuffer3D::fgCSLevel
static UInt_t fgCSLevel
Definition: TBuffer3D.h:45
TBuffer3D::fPolsCapacity
UInt_t fPolsCapacity
Definition: TBuffer3D.h:34
TBuffer3D::fPhysicalID
UInt_t fPhysicalID
Definition: TBuffer3D.h:124
unsigned int
TBuffer3D::TBuffer3D
TBuffer3D(const TBuffer3D &)=delete
TBuffer3D::NbPols
UInt_t NbPols() const
Definition: TBuffer3D.h:88
TBuffer3D::ESection
ESection
Definition: TBuffer3D.h:55
TBuffer3D::ClearSectionsValid
void ClearSectionsValid()
Clear any sections marked valid.
Definition: TBuffer3D.cxx:286
TBuffer3DTube::fRadiusInner
Double_t fRadiusInner
Definition: TBuffer3D.h:174
TBuffer3D::kCSNoOp
@ kCSNoOp
Definition: TBuffer3D.h:49
Double_t
double Double_t
Definition: RtypesCore.h:59
TBuffer3D::fLocalFrame
Bool_t fLocalFrame
Definition: TBuffer3D.h:96
TBuffer3D::EBoolOpCode
EBoolOpCode
Definition: TBuffer3D.h:49
TBuffer3D::NbSegs
UInt_t NbSegs() const
Definition: TBuffer3D.h:87
TBuffer3D::fID
TObject * fID
Definition: TBuffer3D.h:93
TObject.h
TBuffer3D::fBBVertex
Double_t fBBVertex[8][3]
Definition: TBuffer3D.h:113
TBuffer3D::kAll
@ kAll
Definition: TBuffer3D.h:61
TObject
Definition: TObject.h:37
TBuffer3D::Type
Int_t Type() const
Definition: TBuffer3D.h:91
TBuffer3D::~TBuffer3D
virtual ~TBuffer3D()
Destructor.
Definition: TBuffer3D.cxx:235
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TBuffer3D::fNbPols
UInt_t fNbPols
Definition: TBuffer3D.h:30
TBuffer3D::kRawSizes
@ kRawSizes
Definition: TBuffer3D.h:59
TBuffer3D::Init
void Init()
Initialise buffer.
Definition: TBuffer3D.cxx:245
TBuffer3D::fPnts
Double_t * fPnts
Definition: TBuffer3D.h:118
TBuffer3D::kCSIntersection
@ kCSIntersection
Definition: TBuffer3D.h:49
TBuffer3DSphere::operator=
TBuffer3DSphere & operator=(const TBuffer3DSphere &)=delete
type
int type
Definition: TGX11.cxx:121
TBuffer3D::fNbPnts
UInt_t fNbPnts
Definition: TBuffer3D.h:28
TBuffer3D::GetCSLevel
static UInt_t GetCSLevel()
Return CS level.
Definition: TBuffer3D.cxx:496
TBuffer3DTubeSeg
Definition: TBuffer3D.h:183
TBuffer3D::fSegsCapacity
UInt_t fSegsCapacity
Definition: TBuffer3D.h:33
TBuffer3D::fPols
Int_t * fPols
Definition: TBuffer3D.h:120
TBuffer3D::IncCSLevel
static void IncCSLevel()
Increment CS level.
Definition: TBuffer3D.cxx:504
TBuffer3DSphere::fRadiusOuter
Double_t fRadiusOuter
Definition: TBuffer3D.h:144
int
TBuffer3D::kCore
@ kCore
Definition: TBuffer3D.h:56