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/*************************************************************************
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
15Class handling Boolean composition of shapes
16
17 Composite shapes are Boolean combination of two or more shape
18components. The supported boolean operations are union (+), intersection (*)
19and subtraction. Composite shapes derive from the base TGeoShape class,
20therefore providing all shape features : computation of bounding box, finding
21if a given point is inside or outside the combination, as well as computing the
22distance to entering/exiting. It can be directly used for creating volumes or
23used in the definition of other composite shapes.
24
25 Composite shapes are provided in order to complement and extend the set of
26basic shape primitives. They have a binary tree internal structure, therefore
27all shape-related geometry queries are signals propagated from top level down
28to the final leaves, while the provided answers are assembled and interpreted
29back at top. This CSG hierarchy is effective for small number of components,
30while performance drops dramatically for large structures. Building a complete
31geometry 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
36between only two shape components. All information identifying these two
37components as well as their positions with respect to the frame of the composite
38is represented by an object called Boolean node. A composite shape just have
39a pointer to such a Boolean node. Since the shape components may also be
40composites, they will also contain binary Boolean nodes branching other two
41shapes in the hierarchy. Any such branch ends-up when the final leaves are no
42longer 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
47how the internal representation of few combinations look like. We do this
48only for the sake of understanding how to create them in a proper way, since
49the user interface for this purpose is in fact very simple. We will ignore
50for the time being the positioning of components. The definition of a composite
51shape takes an expression where the identifiers are shape names. The
52expression is parsed and decomposed in 2 sub-expressions and the top-level
53Boolean operator.
54
55#### A+B+C
56
57 This represent the union of A, B and C. Both union operators are at the
58same level. Since:
59
60~~~ {.cpp}
61 A+B+C = (A+B)+C = A+(B+C)
62~~~
63
64the first (+) is taken as separator, hence the expression split:
65
66~~~ {.cpp}
67 A and B+C
68~~~
69
70A Boolean node of type TGeoUnion("A", "B+C") is created. This tries to replace
71the 2 expressions by actual pointers to corresponding shapes.
72The first expression (A) contains no operators therefore is interpreted as
73representing a shape. The shape named "A" is searched into the list of shapes
74handled by the manager class and stored as the "left" shape in the Boolean
75union node. Since the second expression is not yet fully decomposed, the "right"
76shape in the combination is created as a new composite shape. This will split
77at its turn B+C into B and C and create a TGeoUnion("B","C"). The B and C
78identifiers will be looked for and replaced by the pointers to the actual shapes
79into 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
91where [] is a composite shape, (+) is a Boolean node of type union and A, B,
92C 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
101B. The usage of parenthesis to force operator precedence is always recommended.
102The 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
121useful since we were using un-positioned shapes. When supplying just shape
122names as identifiers, the created boolean nodes will assume that the shapes
123are positioned with an identity transformation with respect to the frame of
124the created composite. In order to provide some positioning of the combination
125components, we have to attach after each shape identifier the name of an
126existing transformation, separated by a colon. Obviously all transformations
127created for this purpose have to be objects with unique names in order to be
128properly 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
150one on top of the other and having 2 rectangular holes : a longitudinal one
151along 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
153used many times in the same expression. For instance:
154
155~~~ {.cpp}
156 (A:t1-A:t2)*B:t1
157~~~
158
159is a valid expression. Expressions that cannot be parsed or identifiers that
160cannot be substituted by existing objects generate error messages.
161 Composite shapes can be subsequently used for defining volumes. Moreover,
162these volumes may have daughters but these have to obey overlapping/extruding
163rules (see TGeoVolume). Volumes created based on composite shapes cannot be
164divided. Visualization of such volumes is currently not implemented.
165*/
166
167#include "Riostream.h"
168#include "TRandom3.h"
169
170#include "TGeoManager.h"
171#include "TGeoMatrix.h"
172#include "TGeoBoolNode.h"
173
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{
188}
189
190////////////////////////////////////////////////////////////////////////////////
191/// Needed just for cleanup.
192
194{
196}
197
198////////////////////////////////////////////////////////////////////////////////
199/// Default constructor
200
202 :TGeoBBox(0, 0, 0)
203{
205 fNode = 0;
206}
207
208////////////////////////////////////////////////////////////////////////////////
209/// Default constructor
210
211TGeoCompositeShape::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
297void 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
346TGeoVolume *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
356void 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
378void 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{
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;
428 preferLocal);
429
430 Bool_t paintComponents = kTRUE;
431
432 // Start a composite shape, identified by this buffer
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
446 viewer->CloseComposite();
447 }
448
450}
451
452////////////////////////////////////////////////////////////////////////////////
453/// Register the shape and all components to TGeoManager class.
454
456{
457 if (gGeoManager->GetListOfShapes()->FindObject(this)) return;
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)) {
467 }
468 matrix = fNode->GetRightMatrix();
469 if (!matrix->IsRegistered()) matrix->RegisterYourself();
470 else if (!gGeoManager->GetListOfMatrices()->FindObject(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 {
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 {
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
507void TGeoCompositeShape::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
508{
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{
523}
524
525////////////////////////////////////////////////////////////////////////////////
526/// create points for a composite shape
527
529{
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
555void 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
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
573void 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
581void 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
591void 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}
const Bool_t kFALSE
Definition: RtypesCore.h:90
double Double_t
Definition: RtypesCore.h:57
float Float_t
Definition: RtypesCore.h:55
const Bool_t kTRUE
Definition: RtypesCore.h:89
const char Option_t
Definition: RtypesCore.h:64
#define ClassImp(name)
Definition: Rtypes.h:361
char name[80]
Definition: TGX11.cxx:109
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:600
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
point * points
Definition: X3DBuffer.c:22
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
@ kBoundingBox
Definition: TBuffer3D.h:51
static UInt_t DecCSLevel()
Decrement CS level.
Definition: TBuffer3D.cxx:512
static UInt_t GetCSLevel()
Return CS level.
Definition: TBuffer3D.cxx:496
static void IncCSLevel()
Increment CS level.
Definition: TBuffer3D.cxx:504
Box class.
Definition: TGeoBBox.h:18
Double_t fDX
Definition: TGeoBBox.h:21
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:430
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:793
Double_t fOrigin[3]
Definition: TGeoBBox.h:24
Double_t fDY
Definition: TGeoBBox.h:22
Double_t fDZ
Definition: TGeoBBox.h:23
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:1033
Base class for Boolean operations between two shapes.
Definition: TGeoBoolNode.h:25
virtual void Sizeof3D() const
Register size of this 3D object.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)=0
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
TGeoMatrix * GetRightMatrix() const
Definition: TGeoBoolNode.h:81
TGeoShape * GetLeftShape() const
Definition: TGeoBoolNode.h:82
void Paint(Option_t *option) override
Special schema for feeding the 3D buffers to the painter client.
TGeoMatrix * GetLeftMatrix() const
Definition: TGeoBoolNode.h:80
virtual void SetPoints(Double_t *points) const
Fill buffer with shape vertices.
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const =0
virtual Bool_t Contains(const Double_t *point) const =0
virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin)=0
virtual Int_t GetNpoints()=0
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 * GetRightShape() const
Definition: TGeoBoolNode.h:83
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
Class handling Boolean composition of shapes.
TGeoBoolNode * fNode
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...
Needed just for cleanup.
TGeoCompositeShape()
Default constructor.
virtual void InspectShape() const
print shape parameters
virtual Double_t Capacity() const
Computes capacity of this shape [length^3] by sampling with 1% error.
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
virtual void Sizeof3D() const
compute size of this 3D object
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
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.
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...
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.
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.
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...
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.
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal vector in POINT to the composite shape.
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...
Needed just for cleanup.
virtual Bool_t Contains(const Double_t *point) const
Tests if point is inside the shape.
virtual ~TGeoCompositeShape()
destructor
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.
virtual void SetPoints(Double_t *points) const
create points for a composite shape
void RegisterYourself()
Register the shape and all components to TGeoManager class.
virtual void ComputeBBox()
compute bounding box of the sphere
void MakeNode(const char *expression)
Make a boolean node according to the top level boolean operation of expression.
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.
Matrix class used for computing global transformations Should NOT be used for node definition.
Definition: TGeoMatrix.h:421
void Clear(Option_t *option="")
clear the data for this matrix
TObjArray * GetListOfMatrices() const
Definition: TGeoManager.h:488
TVirtualGeoPainter * GetGeomPainter()
Make a default painter if none present. Returns pointer to it.
static Int_t Parse(const char *expr, TString &expr1, TString &expr2, TString &expr3)
Parse a string boolean expression and do a syntax check.
TObjArray * GetListOfShapes() const
Definition: TGeoManager.h:493
Add a shape to the list. Returns index of the shape in list.
Geometrical transformation package.
Definition: TGeoMatrix.h:41
virtual void RegisterYourself()
Register the matrix in the current manager, which will become the owner.
Definition: TGeoMatrix.cxx:526
Bool_t IsRegistered() const
Definition: TGeoMatrix.h:77
Base abstract class for all shapes.
Definition: TGeoShape.h:26
static Double_t Big()
Definition: TGeoShape.h:88
void SetShapeBit(UInt_t f, Bool_t set)
Equivalent of TObject::SetBit.
Definition: TGeoShape.cxx:524
virtual Bool_t IsComposite() const
Definition: TGeoShape.h:130
const char * GetPointerName() const
Provide a pointer name containing uid.
Definition: TGeoShape.cxx:699
Int_t ShapeDistancetoPrimitive(Int_t numpoints, Int_t px, Int_t py) const
Returns distance to shape primitive mesh.
Definition: TGeoShape.cxx:259
virtual const char * GetName() const
Get the shape name.
Definition: TGeoShape.cxx:248
static TGeoMatrix * GetTransform()
Returns current transformation matrix that applies to shape.
Definition: TGeoShape.cxx:536
@ kGeoComb
Definition: TGeoShape.h:59
@ kGeoSavePrimitive
Definition: TGeoShape.h:65
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:47
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
virtual const char * GetTitle() const
Returns title of object.
Definition: TNamed.h:48
Definition: TObjArray.h:74
virtual TObject * FindObject(const char *name) const
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
R__ALWAYS_INLINE Bool_t TestBit(UInt_t f) const
Definition: TObject.h:187
virtual const char * ClassName() const
Returns name of class to which the object belongs.
Definition: TObject.cxx:128
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:877
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:694
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:891
Random number generator class based on M.
Definition: TRandom3.h:27
virtual Double_t Rndm()
Machine independent random number generator.
Definition: TRandom.cxx:541
Basic string class.
Definition: TString.h:131
Ssiz_t Length() const
Definition: TString.h:405
const char * Data() const
Definition: TString.h:364
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
Abstract class for geometry painters.
Abstract 3D shapes viewer.
virtual Bool_t PreferLocalFrame() const =0
virtual void CloseComposite()=0
virtual Bool_t OpenComposite(const TBuffer3D &buffer, Bool_t *addChildren=0)=0
TPaveText * pt