Logo ROOT  
Reference Guide
TGeoCompositeShape.cxx
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 31/01/02
3 
4 /*************************************************************************
5  * Copyright (C) 1995-2000, 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 /** \class TGeoCompositeShape
13 \ingroup Geometry_classes
14 
15 Class handling Boolean composition of shapes
16 
17  Composite shapes are Boolean combination of two or more shape
18 components. The supported boolean operations are union (+), intersection (*)
19 and subtraction. Composite shapes derive from the base TGeoShape class,
20 therefore providing all shape features : computation of bounding box, finding
21 if a given point is inside or outside the combination, as well as computing the
22 distance to entering/exiting. It can be directly used for creating volumes or
23 used in the definition of other composite shapes.
24 
25  Composite shapes are provided in order to complement and extend the set of
26 basic shape primitives. They have a binary tree internal structure, therefore
27 all shape-related geometry queries are signals propagated from top level down
28 to the final leaves, while the provided answers are assembled and interpreted
29 back at top. This CSG hierarchy is effective for small number of components,
30 while performance drops dramatically for large structures. Building a complete
31 geometry in this style is virtually possible but highly not recommended.
32 
33 ### Structure of composite shapes
34 
35  A composite shape can always be regarded as the result of a Boolean operation
36 between only two shape components. All information identifying these two
37 components as well as their positions with respect to the frame of the composite
38 is represented by an object called Boolean node. A composite shape just have
39 a pointer to such a Boolean node. Since the shape components may also be
40 composites, they will also contain binary Boolean nodes branching other two
41 shapes in the hierarchy. Any such branch ends-up when the final leaves are no
42 longer composite shapes, but basic primitives.
43 
44 \image html geom_booltree.png
45 
46  Suppose that A, B, C and D represent basic shapes, we will illustrate
47 how the internal representation of few combinations look like. We do this
48 only for the sake of understanding how to create them in a proper way, since
49 the user interface for this purpose is in fact very simple. We will ignore
50 for the time being the positioning of components. The definition of a composite
51 shape takes an expression where the identifiers are shape names. The
52 expression is parsed and decomposed in 2 sub-expressions and the top-level
53 Boolean operator.
54 
55 #### A+B+C
56 
57  This represent the union of A, B and C. Both union operators are at the
58 same level. Since:
59 
60 ~~~ {.cpp}
61  A+B+C = (A+B)+C = A+(B+C)
62 ~~~
63 
64 the first (+) is taken as separator, hence the expression split:
65 
66 ~~~ {.cpp}
67  A and B+C
68 ~~~
69 
70 A Boolean node of type TGeoUnion("A", "B+C") is created. This tries to replace
71 the 2 expressions by actual pointers to corresponding shapes.
72 The first expression (A) contains no operators therefore is interpreted as
73 representing a shape. The shape named "A" is searched into the list of shapes
74 handled by the manager class and stored as the "left" shape in the Boolean
75 union node. Since the second expression is not yet fully decomposed, the "right"
76 shape in the combination is created as a new composite shape. This will split
77 at its turn B+C into B and C and create a TGeoUnion("B","C"). The B and C
78 identifiers will be looked for and replaced by the pointers to the actual shapes
79 into the new node. Finally, the composite "A+B+C" will be represented as:
80 
81 ~~~ {.cpp}
82  A
83  |
84  [A+B+C] = (+) B
85  | |
86  [B+C] = (+)
87  |
88  C
89 ~~~
90 
91 where [] is a composite shape, (+) is a Boolean node of type union and A, B,
92 C are pointers to the corresponding shapes.
93  Building this composite shapes takes the following line :
94 
95 ~~~ {.cpp}
96  TGeoCompositeShape *cs1 = new TGeoCompositeShape("CS1", "A+B+C");
97 ~~~
98 
99 #### (A+B)-(C+D)
100  This expression means: subtract the union of C and D from the union of A and
101 B. The usage of parenthesis to force operator precedence is always recommended.
102 The representation of the corresponding composite shape looks like:
103 
104 ~~~ {.cpp}
105  A
106  |
107  [A+B] = (+)
108  | |
109  [(A+B)-(C+D)] = (-) C B
110  | |
111  [C+D]=(+)
112  |
113  D
114 ~~~
115 
116 ~~~ {.cpp}
117  TGeoCompositeShape *cs2 = new TGeoCompositeShape("CS2", "(A+B)-(C+D)");
118 ~~~
119 
120  Building composite shapes as in the 2 examples above is not always quite
121 useful since we were using un-positioned shapes. When supplying just shape
122 names as identifiers, the created boolean nodes will assume that the shapes
123 are positioned with an identity transformation with respect to the frame of
124 the created composite. In order to provide some positioning of the combination
125 components, we have to attach after each shape identifier the name of an
126 existing transformation, separated by a colon. Obviously all transformations
127 created for this purpose have to be objects with unique names in order to be
128 properly substituted during parsing.
129  Let's look at the code implementing the second example :
130 
131 ~~~ {.cpp}
132  TGeoTranslation *t1 = new TGeoTranslation("t1",0,0,-20);
133  TGeoTranslation *t2 = new TGeoTranslation("t2",0,0, 20);
134  TGeoRotation *r1 = new TGeoRotation("r1"); // transformations need names
135  r1->SetAngles(90,30,90,120,0,0); // rotation with 30 degrees about Z
136  TGeoTube *a = new TGeoTube(0, 10,20);
137  a->SetName("A"); // shapes need names too
138  TGeoTube *b = new TGeoTube(0, 20,20);
139  b->SetName("B");
140  TGeoBBox *c = new TGeoBBox(10,10,50);
141  c->SetName("C");
142  TGeoBBox *d = new TGeoBBox(50,10,10);
143  d->SetName("D");
144 
145  TGeoCompositeShape *cs;
146  cs = new TGeoCompositeShape("CS", "(A:t1+B:t2)-(C+D:r1)");
147 ~~~
148 
149  The newly created composite looks like 2 cylinders of different radii sitting
150 one on top of the other and having 2 rectangular holes : a longitudinal one
151 along Z axis corresponding to C and an other one in the XY plane due to D.
152  One should have in mind that the same shape or matrix identifier can be
153 used many times in the same expression. For instance:
154 
155 ~~~ {.cpp}
156  (A:t1-A:t2)*B:t1
157 ~~~
158 
159 is a valid expression. Expressions that cannot be parsed or identifiers that
160 cannot be substituted by existing objects generate error messages.
161  Composite shapes can be subsequently used for defining volumes. Moreover,
162 these volumes may have daughters but these have to obey overlapping/extruding
163 rules (see TGeoVolume). Volumes created based on composite shapes cannot be
164 divided. Visualization of such volumes is currently not implemented.
165 */
166 
167 #include <iostream>
168 #include "TRandom3.h"
169 
170 #include "TGeoManager.h"
171 #include "TGeoMatrix.h"
172 #include "TGeoBoolNode.h"
173 
174 #include "TVirtualPad.h"
175 #include "TVirtualViewer3D.h"
176 #include "TBuffer3D.h"
177 #include "TBuffer3DTypes.h"
178 
179 #include "TGeoCompositeShape.h"
181 
182 ////////////////////////////////////////////////////////////////////////////////
183 /// Needed just for cleanup.
184 
186 {
187  if (fNode) fNode->ClearThreadData();
188 }
189 
190 ////////////////////////////////////////////////////////////////////////////////
191 /// Needed just for cleanup.
192 
194 {
195  if (fNode) fNode->CreateThreadData(nthreads);
196 }
197 
198 ////////////////////////////////////////////////////////////////////////////////
199 /// Default constructor
200 
202  :TGeoBBox(0, 0, 0)
203 {
205  fNode = 0;
206 }
207 
208 ////////////////////////////////////////////////////////////////////////////////
209 /// Default constructor
210 
211 TGeoCompositeShape::TGeoCompositeShape(const char *name, const char *expression)
212  :TGeoBBox(0, 0, 0)
213 {
215  SetName(name);
216  fNode = 0;
217  MakeNode(expression);
218  if (!fNode) {
219  Error("ctor", "Composite %s: cannot parse expression: %s", name, expression);
220  return;
221  }
222  ComputeBBox();
223 }
224 
225 ////////////////////////////////////////////////////////////////////////////////
226 /// Default constructor
227 
229  :TGeoBBox(0, 0, 0)
230 {
232  fNode = 0;
233  MakeNode(expression);
234  if (!fNode) {
235  TString message = TString::Format("Composite (no name) could not parse expression %s", expression);
236  Error("ctor", "%s", message.Data());
237  return;
238  }
239  ComputeBBox();
240 }
241 
242 ////////////////////////////////////////////////////////////////////////////////
243 /// Constructor with a Boolean node
244 
246  :TGeoBBox(0,0,0)
247 {
248  SetName(name);
249  fNode = node;
250  if (!fNode) {
251  Error("ctor", "Composite shape %s has null node", name);
252  return;
253  }
254  ComputeBBox();
255 }
256 
257 ////////////////////////////////////////////////////////////////////////////////
258 /// destructor
259 
261 {
262  if (fNode) delete fNode;
263 }
264 
265 ////////////////////////////////////////////////////////////////////////////////
266 /// Computes capacity of this shape [length^3] by sampling with 1% error.
267 
269 {
270  Double_t pt[3];
271  if (!gRandom) gRandom = new TRandom3();
272  Double_t vbox = 8*fDX*fDY*fDZ; // cm3
273  Int_t igen=0;
274  Int_t iin = 0;
275  while (iin<10000) {
276  pt[0] = fOrigin[0]-fDX+2*fDX*gRandom->Rndm();
277  pt[1] = fOrigin[1]-fDY+2*fDY*gRandom->Rndm();
278  pt[2] = fOrigin[2]-fDZ+2*fDZ*gRandom->Rndm();
279  igen++;
280  if (Contains(pt)) iin++;
281  }
282  Double_t capacity = iin*vbox/igen;
283  return capacity;
284 }
285 
286 ////////////////////////////////////////////////////////////////////////////////
287 /// compute bounding box of the sphere
288 
290 {
292 }
293 
294 ////////////////////////////////////////////////////////////////////////////////
295 /// Computes normal vector in POINT to the composite shape.
296 
297 void TGeoCompositeShape::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
298 {
299  if (fNode) fNode->ComputeNormal(point,dir,norm);
300 }
301 
302 ////////////////////////////////////////////////////////////////////////////////
303 /// Tests if point is inside the shape.
304 
306 {
307  if (fNode) return fNode->Contains(point);
308  return kFALSE;
309 }
310 
311 ////////////////////////////////////////////////////////////////////////////////
312 /// Compute closest distance from point px,py to each corner.
313 
315 {
316  const Int_t numPoints = GetNmeshVertices();
317  return ShapeDistancetoPrimitive(numPoints, px, py);
318 }
319 
320 ////////////////////////////////////////////////////////////////////////////////
321 /// Compute distance from outside point to this composite shape.
322 /// Check if the bounding box is crossed within the requested distance
323 
325  Double_t step, Double_t *safe) const
326 {
327  Double_t sdist = TGeoBBox::DistFromOutside(point,dir, fDX, fDY, fDZ, fOrigin, step);
328  if (sdist>=step) return TGeoShape::Big();
329  if (fNode) return fNode->DistFromOutside(point, dir, iact, step, safe);
330  return TGeoShape::Big();
331 }
332 
333 ////////////////////////////////////////////////////////////////////////////////
334 /// Compute distance from inside point to outside of this composite shape.
335 
337  Double_t step, Double_t *safe) const
338 {
339  if (fNode) return fNode->DistFromInside(point, dir, iact, step, safe);
340  return TGeoShape::Big();
341 }
342 
343 ////////////////////////////////////////////////////////////////////////////////
344 /// Divide all range of iaxis in range/step cells
345 
346 TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/,
347  Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/)
348 {
349  Error("Divide", "Composite shapes cannot be divided");
350  return 0;
351 }
352 
353 ////////////////////////////////////////////////////////////////////////////////
354 /// Returns numbers of vertices, segments and polygons composing the shape mesh.
355 
356 void TGeoCompositeShape::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
357 {
358  nvert = GetNmeshVertices();
359  nsegs = 0;
360  npols = 0;
361 }
362 
363 ////////////////////////////////////////////////////////////////////////////////
364 /// print shape parameters
365 
367 {
368  printf("*** TGeoCompositeShape : %s = %s\n", GetName(), GetTitle());
369  printf(" Bounding box:\n");
371 }
372 
373 ////////////////////////////////////////////////////////////////////////////////
374 /// Make a boolean node according to the top level boolean operation of expression.
375 /// Propagates signal to branches until expression is fully decomposed.
376 /// printf("Making node for : %s\n", expression);
377 
378 void TGeoCompositeShape::MakeNode(const char *expression)
379 {
380  if (fNode) delete fNode;
381  fNode = 0;
382  SetTitle(expression);
383  TString sleft, sright, smat;
384  Int_t boolop;
385  boolop = TGeoManager::Parse(expression, sleft, sright, smat);
386  if (boolop<0) {
387  // fail
388  Error("MakeNode", "parser error");
389  return;
390  }
391  if (smat.Length())
392  Warning("MakeNode", "no geometrical transformation allowed at this level");
393  switch (boolop) {
394  case 0:
395  Error("MakeNode", "Expression has no boolean operation");
396  return;
397  case 1:
398  fNode = new TGeoUnion(sleft.Data(), sright.Data());
399  return;
400  case 2:
401  fNode = new TGeoSubtraction(sleft.Data(), sright.Data());
402  return;
403  case 3:
404  fNode = new TGeoIntersection(sleft.Data(), sright.Data());
405  }
406 }
407 
408 ////////////////////////////////////////////////////////////////////////////////
409 /// Paint this composite shape into the current 3D viewer
410 /// Returns bool flag indicating if the caller should continue to
411 /// paint child objects
412 
414 {
415  Bool_t addChildren = kTRUE;
416 
418  TVirtualViewer3D * viewer = gPad->GetViewer3D();
419  if (!painter || !viewer) return kFALSE;
420 
421  if (fNode) {
422  // Fill out the buffer for the composite shape - nothing extra
423  // over TGeoBBox
424  Bool_t preferLocal = viewer->PreferLocalFrame();
425  if (TBuffer3D::GetCSLevel()) preferLocal = kFALSE;
426  static TBuffer3D buffer(TBuffer3DTypes::kComposite);
428  preferLocal);
429 
430  Bool_t paintComponents = kTRUE;
431 
432  // Start a composite shape, identified by this buffer
433  if (!TBuffer3D::GetCSLevel())
434  paintComponents = viewer->OpenComposite(buffer, &addChildren);
435 
437 
438  // Paint the boolean node - will add more buffers to viewer
440  TGeoHMatrix backup(*matrix);
441  if (preferLocal) matrix->Clear();
442  if (paintComponents) fNode->Paint(option);
443  if (preferLocal) *matrix = backup;
444  // Close the composite shape
445  if (!TBuffer3D::DecCSLevel())
446  viewer->CloseComposite();
447  }
448 
449  return addChildren;
450 }
451 
452 ////////////////////////////////////////////////////////////////////////////////
453 /// Register the shape and all components to TGeoManager class.
454 
456 {
457  if (gGeoManager->GetListOfShapes()->FindObject(this)) return;
458  gGeoManager->AddShape(this);
459  TGeoMatrix *matrix;
460  TGeoShape *shape;
461  TGeoCompositeShape *comp;
462  if (fNode) {
463  matrix = fNode->GetLeftMatrix();
464  if (!matrix->IsRegistered()) matrix->RegisterYourself();
465  else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
466  gGeoManager->GetListOfMatrices()->Add(matrix);
467  }
468  matrix = fNode->GetRightMatrix();
469  if (!matrix->IsRegistered()) matrix->RegisterYourself();
470  else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
471  gGeoManager->GetListOfMatrices()->Add(matrix);
472  }
473  shape = fNode->GetLeftShape();
474  if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
475  if (shape->IsComposite()) {
476  comp = (TGeoCompositeShape*)shape;
477  comp->RegisterYourself();
478  } else {
479  gGeoManager->AddShape(shape);
480  }
481  }
482  shape = fNode->GetRightShape();
483  if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
484  if (shape->IsComposite()) {
485  comp = (TGeoCompositeShape*)shape;
486  comp->RegisterYourself();
487  } else {
488  gGeoManager->AddShape(shape);
489  }
490  }
491  }
492 }
493 
494 ////////////////////////////////////////////////////////////////////////////////
495 /// computes the closest distance from given point to this shape, according
496 /// to option. The matching point on the shape is stored in spoint.
497 
499 {
500  if (fNode) return fNode->Safety(point,in);
501  return 0.;
502 }
503 
504 ////////////////////////////////////////////////////////////////////////////////
505 /// Save a primitive as a C++ statement(s) on output stream "out".
506 
507 void TGeoCompositeShape::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
508 {
509  if (TObject::TestBit(kGeoSavePrimitive)) return;
510  if (fNode) fNode->SavePrimitive(out,option);
511  out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
512  out << " TGeoShape *" << GetPointerName() << " = new TGeoCompositeShape(\"" << GetName() << "\", pBoolNode);" << std::endl;
513  if (strlen(GetTitle())) out << " " << GetPointerName() << "->SetTitle(\"" << GetTitle() << "\");" << std::endl;
515 }
516 
517 ////////////////////////////////////////////////////////////////////////////////
518 /// create points for a composite shape
519 
521 {
522  if (fNode) fNode->SetPoints(points);
523 }
524 
525 ////////////////////////////////////////////////////////////////////////////////
526 /// create points for a composite shape
527 
529 {
530  if (fNode) fNode->SetPoints(points);
531 }
532 
533 ////////////////////////////////////////////////////////////////////////////////
534 /// compute size of this 3D object
535 
537 {
538  if (fNode) fNode->Sizeof3D();
539 }
540 
541 ////////////////////////////////////////////////////////////////////////////////
542 /// Return number of vertices of the mesh representation
543 
545 {
546  if (!fNode) return 0;
547  return fNode->GetNpoints();
548 }
549 
550 ////////////////////////////////////////////////////////////////////////////////
551 /// Check the inside status for each of the points in the array.
552 /// Input: Array of point coordinates + vector size
553 /// Output: Array of Booleans for the inside of each point
554 
555 void TGeoCompositeShape::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
556 {
557  for (Int_t i=0; i<vecsize; i++) inside[i] = Contains(&points[3*i]);
558 }
559 
560 ////////////////////////////////////////////////////////////////////////////////
561 /// Compute the normal for an array o points so that norm.dot.dir is positive
562 /// Input: Arrays of point coordinates and directions + vector size
563 /// Output: Array of normal directions
564 
565 void TGeoCompositeShape::ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
566 {
567  for (Int_t i=0; i<vecsize; i++) ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
568 }
569 
570 ////////////////////////////////////////////////////////////////////////////////
571 /// Compute distance from array of input points having directions specified by dirs. Store output in dists
572 
573 void TGeoCompositeShape::DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
574 {
575  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
576 }
577 
578 ////////////////////////////////////////////////////////////////////////////////
579 /// Compute distance from array of input points having directions specified by dirs. Store output in dists
580 
581 void TGeoCompositeShape::DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
582 {
583  for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
584 }
585 
586 ////////////////////////////////////////////////////////////////////////////////
587 /// Compute safe distance from each of the points in the input array.
588 /// Input: Array of point coordinates, array of statuses for these points, size of the arrays
589 /// Output: Safety values
590 
591 void TGeoCompositeShape::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
592 {
593  for (Int_t i=0; i<vecsize; i++) safe[i] = Safety(&points[3*i], inside[i]);
594 }
TGeoCompositeShape::InspectShape
virtual void InspectShape() const
print shape parameters
Definition: TGeoCompositeShape.cxx:366
TGeoCompositeShape::RegisterYourself
void RegisterYourself()
Register the shape and all components to TGeoManager class.
Definition: TGeoCompositeShape.cxx:455
TVirtualViewer3D::OpenComposite
virtual Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
TVirtualViewer3D::CloseComposite
virtual void CloseComposite()=0
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoCompositeShape::Contains
virtual Bool_t Contains(const Double_t *point) const
Tests if point is inside the shape.
Definition: TGeoCompositeShape.cxx:305
TObject::TestBit
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:172
TNamed::SetName
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
Option_t
const char Option_t
Definition: RtypesCore.h:66
TGeoBoolNode::ComputeNormal
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
TGeoShape::IsComposite
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
TGeoCompositeShape::~TGeoCompositeShape
virtual ~TGeoCompositeShape()
destructor
Definition: TGeoCompositeShape.cxx:260
TGeoBoolNode::GetLeftShape
TGeoShape * GetLeftShape() const
Definition: TGeoBoolNode.h:83
gGeoManager
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
TString::Data
const char * Data() const
Definition: TString.h:369
TGeoBoolNode
Base class for Boolean operations between two shapes.
Definition: TGeoBoolNode.h:26
ClassImp
#define ClassImp(name)
Definition: Rtypes.h:364
TNamed::GetTitle
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
TBuffer3D::DecCSLevel
static UInt_t DecCSLevel()
Decrement CS level.
Definition: TBuffer3D.cxx:512
TGeoCompositeShape::Sizeof3D
virtual void Sizeof3D() const
compute size of this 3D object
Definition: TGeoCompositeShape.cxx:536
TObject::Error
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:890
TGeoBBox::fOrigin
Double_t fOrigin[3]
Definition: TGeoBBox.h:24
TGeoBoolNode::GetNpoints
virtual Int_t GetNpoints()=0
TGeoBoolNode::SetPoints
virtual void SetPoints(Double_t *points) const
Fill buffer with shape vertices.
Definition: TGeoBoolNode.cxx:391
Float_t
float Float_t
Definition: RtypesCore.h:57
TGeoBoolNode::DistFromOutside
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=nullptr) const =0
TGeoCompositeShape::Capacity
virtual Double_t Capacity() const
Computes capacity of this shape [length^3] by sampling with 1% error.
Definition: TGeoCompositeShape.cxx:268
TGeoShape::kGeoComb
@ kGeoComb
Definition: TGeoShape.h:59
TString::Length
Ssiz_t Length() const
Definition: TString.h:410
TGeoCompositeShape::DistFromInside
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from inside point to outside of this composite shape.
Definition: TGeoCompositeShape.cxx:336
TGeoShape::SetShapeBit
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
Definition: TGeoShape.cxx:524
TString::Format
static TString Format(const char *fmt,...)
Static method which formats a string using a printf style format descriptor and return a TString.
Definition: TString.cxx:2311
TGeoCompositeShape::DistFromOutside
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to this composite shape.
Definition: TGeoCompositeShape.cxx:324
TString
Basic string class.
Definition: TString.h:136
TGeoBoolNode::Contains
virtual Bool_t Contains(const Double_t *point) const =0
TGeoMatrix::IsRegistered
Bool_t IsRegistered() const
Definition: TGeoMatrix.h:77
TGeoShape::GetTransform
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:536
bool
TGeoCompositeShape
Class handling Boolean composition of shapes.
Definition: TGeoCompositeShape.h:28
TGeoBoolNode::SavePrimitive
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoBoolNode.cxx:374
TObjArray::Add
void Add(TObject *obj)
Definition: TObjArray.h:74
TGeoCompositeShape::GetNmeshVertices
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoCompositeShape.cxx:544
TGeoHMatrix::Clear
void Clear(Option_t *option="")
clear the data for this matrix
Definition: TGeoMatrix.cxx:2421
TBuffer3D::kBoundingBox
@ kBoundingBox
Definition: TBuffer3D.h:51
TVirtualViewer3D::PreferLocalFrame
virtual Bool_t PreferLocalFrame() const =0
TBuffer3D
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
TGeoCompositeShape::DistFromInside_v
virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Definition: TGeoCompositeShape.cxx:573
TGeoBoolNode::GetLeftMatrix
TGeoMatrix * GetLeftMatrix() const
Definition: TGeoBoolNode.h:81
TGeoCompositeShape::fNode
TGeoBoolNode * fNode
Definition: TGeoCompositeShape.h:31
TGeoShape
Base abstract class for all shapes.
Definition: TGeoShape.h:26
TGeoHMatrix
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition: TGeoMatrix.h:421
TGeoBBox::InspectShape
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:792
TRandom3
Random number generator class based on M.
Definition: TRandom3.h:27
TGeoManager::GetGeomPainter
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
Definition: TGeoManager.cxx:2685
TGeoCompositeShape::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoCompositeShape.cxx:507
TObject::SetBit
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:696
TGeoBBox::fDY
Double_t fDY
Definition: TGeoBBox.h:22
TVirtualViewer3D.h
TBuffer3D.h
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGeoBoolNode::Paint
void Paint(Option_t *option) override
Special schema for feeding the 3D buffers to the painter client.
Definition: TGeoBoolNode.cxx:294
TGeoBoolNode::ComputeBBox
virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin)=0
TGeoShape::kGeoSavePrimitive
@ kGeoSavePrimitive
Definition: TGeoShape.h:65
TGeoBoolNode::GetRightMatrix
TGeoMatrix * GetRightMatrix() const
Definition: TGeoBoolNode.h:82
gRandom
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
TRandom3.h
TBuffer3DTypes.h
TVirtualPad.h
TGeoShape::GetName
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
TRandom::Rndm
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:552
TGeoBBox
Box class.
Definition: TGeoBBox.h:18
TGeoCompositeShape::Safety_v
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
Definition: TGeoCompositeShape.cxx:591
TGeoCompositeShape.h
TGeoBBox::FillBuffer3D
virtual void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const
Fills the supplied buffer, with sections in desired frame See TBuffer3D.h for explanation of sections...
Definition: TGeoBBox.cxx:1032
TNamed::SetTitle
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
TObject::Warning
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:876
TGeoBoolNode::Sizeof3D
virtual void Sizeof3D() const
Register size of this 3D object.
Definition: TGeoBoolNode.cxx:411
TGeoMatrix.h
TGeoIntersection
Definition: TGeoBoolNode.h:145
TGeoManager.h
TGeoBBox::fDZ
Double_t fDZ
Definition: TGeoBBox.h:23
TGeoShape::GetPointerName
const char * GetPointerName() const
Provide a pointer name containing uid.
Definition: TGeoShape.cxx:699
TVirtualGeoPainter
Abstract class for geometry painters.
Definition: TVirtualGeoPainter.h:32
Double_t
double Double_t
Definition: RtypesCore.h:59
TGeoMatrix
Geometrical transformation package.
Definition: TGeoMatrix.h:41
TGeoCompositeShape::ComputeBBox
virtual void ComputeBBox()
compute bounding box of the sphere
Definition: TGeoCompositeShape.cxx:289
TObjArray::FindObject
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
TGeoCompositeShape::CreateThreadData
virtual void CreateThreadData(Int_t nthreads)
Needed just for cleanup.
Definition: TGeoCompositeShape.cxx:193
TGeoCompositeShape::ComputeNormal_v
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
Definition: TGeoCompositeShape.cxx:565
TGeoUnion
Definition: TGeoBoolNode.h:106
points
point * points
Definition: X3DBuffer.c:22
TGeoBoolNode::Safety
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
TVirtualViewer3D
Abstract 3D shapes viewer.
Definition: TVirtualViewer3D.h:34
TGeoBoolNode::CreateThreadData
void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
Definition: TGeoBoolNode.cxx:107
TBuffer3DTypes::kComposite
@ kComposite
Definition: TBuffer3DTypes.h:25
name
char name[80]
Definition: TGX11.cxx:110
TGeoCompositeShape::Divide
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
Divide all range of iaxis in range/step cells.
Definition: TGeoCompositeShape.cxx:346
TGeoShape::ShapeDistancetoPrimitive
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
Definition: TGeoShape.cxx:259
TGeoCompositeShape::GetMeshNumbers
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition: TGeoCompositeShape.cxx:356
TGeoBoolNode::GetRightShape
TGeoShape * GetRightShape() const
Definition: TGeoBoolNode.h:84
TGeoBoolNode.h
gPad
#define gPad
Definition: TVirtualPad.h:287
TGeoCompositeShape::ClearThreadData
virtual void ClearThreadData() const
Needed just for cleanup.
Definition: TGeoCompositeShape.cxx:185
TGeoCompositeShape::ComputeNormal
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal vector in POINT to the composite shape.
Definition: TGeoCompositeShape.cxx:297
TGeoCompositeShape::PaintComposite
virtual Bool_t PaintComposite(Option_t *option="") const
Paint this composite shape into the current 3D viewer Returns bool flag indicating if the caller shou...
Definition: TGeoCompositeShape.cxx:413
TGeoMatrix::RegisterYourself
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:526
TGeoCompositeShape::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoCompositeShape.cxx:314
TGeoBoolNode::ClearThreadData
void ClearThreadData() const
Definition: TGeoBoolNode.cxx:91
TGeoCompositeShape::TGeoCompositeShape
TGeoCompositeShape()
Default constructor.
Definition: TGeoCompositeShape.cxx:201
TGeoBoolNode::DistFromInside
virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=0, Double_t *safe=nullptr) const =0
TGeoShape::Big
static Double_t Big()
Definition: TGeoShape.h:88
TGeoManager::Parse
static Int_t Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3)
Parse a string boolean expression and do a syntax check.
Definition: TGeoManager.cxx:2325
pt
TPaveText * pt
Definition: entrylist_figure1.C:7
TBuffer3D::GetCSLevel
static UInt_t GetCSLevel()
Return CS level.
Definition: TBuffer3D.cxx:496
TGeoManager::GetListOfShapes
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:495
TGeoManager::GetListOfMatrices
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:490
TGeoCompositeShape::MakeNode
void MakeNode(const char *expression)
Make a boolean node according to the top level boolean operation of expression.
Definition: TGeoCompositeShape.cxx:378
TGeoManager::AddShape
Int_t AddShape(const TGeoShape *shape)
Add a shape to the list. Returns index of the shape in list.
Definition: TGeoManager.cxx:632
TObject::ClassName
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:130
TGeoBBox::DistFromOutside
virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1, Double_t step=TGeoShape::Big(), Double_t *safe=0) const
Compute distance from outside point to surface of the box.
Definition: TGeoBBox.cxx:429
TGeoCompositeShape::SetPoints
virtual void SetPoints(Double_t *points) const
create points for a composite shape
Definition: TGeoCompositeShape.cxx:520
TGeoSubtraction
Definition: TGeoBoolNode.h:183
TGeoVolume
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:49
TGeoBBox::fDX
Double_t fDX
Definition: TGeoBBox.h:21
TGeoCompositeShape::DistFromOutside_v
virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const
Compute distance from array of input points having directions specified by dirs. Store output in dist...
Definition: TGeoCompositeShape.cxx:581
TBuffer3D::IncCSLevel
static void IncCSLevel()
Increment CS level.
Definition: TBuffer3D.cxx:504
TGeoCompositeShape::Safety
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
Definition: TGeoCompositeShape.cxx:498
int
TGeoCompositeShape::Contains_v
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
Definition: TGeoCompositeShape.cxx:555
TBuffer3D::kCore
@ kCore
Definition: TBuffer3D.h:50