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