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. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. * 9 * For the list of contributors see$ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12
13/** \class TGeoCompositeShape
14\ingroup Shapes_classes
15
16Composite shapes are Boolean combinations of two or more shape
17components. The supported Boolean operations are union (+), intersection
18(\*) and subtraction(-). Composite shapes derive from the base
19**TGeoShape** class, therefore providing all shape features:
20computation of bounding box, finding if a given point is inside or
21outside the combination, as well as computing the distance to
22entering/exiting. They can be directly used for creating volumes or used
23in the definition of other composite shapes.
24
25Composite shapes are provided in order to complement and extend the set
26of basic shape primitives. They have a binary tree internal structure,
27therefore all shape-related geometry queries are signals propagated from
28top level down to the final leaves, while the provided answers are
29assembled and interpreted back at top. This CSG
30(composite solid geometry) hierarchy is effective for small number of
31components, while performance drops dramatically for large structures.
32Building a complete geometry in this style is virtually possible but
33highly not recommended.
34
35#### The Structure of Composite Shapes
36
37A composite shape can always be looked as the result of a Boolean
38operation between only two shape components. All information identifying
39these two components as well as their positions with respect to the
40frame of the composite is represented by an object called Boolean node.
41A composite shape has a pointer to such a Boolean node. Since the shape
42components may also be composites, they will also contain binary Boolean
43nodes branching out other two shapes in the hierarchy. Any such branch
44ends-up when the final leaves are no longer composite shapes, but basic
45primitives. The figure shows the composite shapes structure.
46
47\image html geom_composite_shape001.png "The composite shapes structure" width=600px
48
49Suppose that A, B, C and D represent basic shapes, we will illustrate
50how the internal representation of few combinations look like. We do
51this only for understanding how to create them in a proper way, since
52the user interface for this purpose is in fact very simple. We will
53ignore for the time being the positioning of components. The definition
54of a composite shape takes an expression where the identifiers are shape
55names. The expression is parsed and decomposed in 2 sub-expressions and
56the top-level Boolean operator.
57
581. Union: A+B+C
59
60Just to illustrate the Boolean expression parsing and the composite
61shape structure, let's take a simple example. We will describe the union
62of A, B and C. Both union operators are at the same level. Since:
63
64A+B+C = (A+B)+C = A+(B+C)
65
66The first (+) is taken as separator, hence the expression split in:
67A and (B+C). A Boolean node of type **TGeoUnion**("A","B+C") is
68created. This tries to replace the 2 expressions by actual pointers to
69corresponding shapes. The first expression (A) contains no operators
70therefore is interpreted as representing a shape. The shape named "A" is
71searched into the list of shapes handled by the manager class and stored
72as the "left" shape in the Boolean union node. Since the second
73expression is not yet fully decomposed, the "right" shape in the
74combination is created as a new composite shape. This will split at its
75turn B+C into B and C and create a **TGeoUnion**("B","C"). The B and
76C identifiers will be looked for and replaced by the pointers to the
77actual shapes into the new node. Finally, the composite "A+B+C" will
78be represented as shown in Fig.17-23.**
79
80\image html geom_composite_shape002.png "Representation of A+B+C" width=600px
81
82To build this composite shape:
83
84~~~{.cpp}
85TGeoCompositeShape *cs1 = new TGeoCompositeShape("CS1","A+B+C");
86~~~
87
88Any shape entering a Boolean combination can be prior positioned. In
89order to do so, one has to attach a matrix name to the shape name by
90using a colon (:). As for shapes, the named matrix has to be prior
91defined:
92
93~~~{.cpp}
94TGeoMatrix *mat;
95// ... code creating some geometrical transformation
96mat->SetName("mat1");
97mat->RegisterYourself(); // see Geometrical transformations
98~~~
99
100An identifier shape:matrix have the meaning: shape is translated or
101rotated with matrix with respect to the Boolean combination it enters
102as operand. Note that in the expression A+B+C no matrix identifier was
103provided, therefore the identity matrix was used for positioning the
104shape components. The next example will illustrate a more complex case.
105
1062. (A:m1+B):m2-(C:m3*D:m4):m5
107
108Let's try to understand the expression above. This expression means:
109subtract the intersection of **C** and **D** from the union of **A** and
110**B**. The usage of parenthesis to force the desired precedence is
111always recommended. One can see that not only the primitive shapes have
112some geometrical transformations, but also their intermediate
113compositions.
114
115
116\image html geom_composite_shape003.png "Internal representation for composite shapes" width=600px
117
118~~~{.cpp}
119TGeoCompositeShape *cs2 = new TGeoCompositeShape("CS2",
120"(A:m1+B):m2-(C:m3*D:m4):m5");
121~~~
122
123Building composite shapes as in the first example is not always quite
124useful since we were using un-positioned shapes. When supplying just
125shape names as identifiers, the created Boolean nodes will assume that
126the shapes are positioned with an identity transformation with respect
127to the frame of the created composite. In order to provide some
128positioning of the combination components, we have to attach after each
129shape identifier the name of an existing transformation, separated by a
130colon. Obviously all transformations created for this purpose have to be
131objects with unique names in order to be properly substituted during
132parsing.
133
134#### Composite Shape Example
135
136One should have in mind that the same shape or matrix identifiers can be
137used many times in the same expression, as in the following example:
138
139~~~{.cpp}
140{
141 TCanvas *c = new TCanvas("c", "c",0,0,600,600);
142 const Double_t sq2 = TMath::Sqrt(2.);
143 TGeoManager *mgr =
144 new TGeoManager("Geom","composite shape example");
145 TGeoMedium *medium = 0;
146 TGeoVolume *top = mgr->MakeBox("TOP",medium,100,250,250);
147 mgr->SetTopVolume(top);
148
149 // make shape components
150 TGeoBBox *sbox = new TGeoBBox("B",100,125*sq2,125*sq2);
151 TGeoTube *stub = new TGeoTube("T",0,100,250);
152 TGeoPgon *spgon = new TGeoPgon("P",0.,360.,6,2);
153 spgon->DefineSection(0,-250,0,80);
154 spgon->DefineSection(1,250,0,80);
155
156 // define some rotations
157 TGeoRotation *r1 = new TGeoRotation("r1",90,0,0,180,90,90);
158 r1->RegisterYourself();
159 TGeoRotation *r2 = new TGeoRotation("r2",90,0,45,90,45,270);
160 r2->RegisterYourself();
161 // create a composite
162 TGeoCompositeShape *cs = new TGeoCompositeShape("cs", "((T+T:r1)-(P+P:r1))*B:r2");
163 TGeoVolume *comp = new TGeoVolume("COMP",cs);
164 comp->SetLineColor(kRed);
165
166 // put it in the top volume
168 mgr->CloseGeometry();
169 // visualize it with ray tracing
170 top->Raytrace();
171}
172~~~
173
174\image html geom_composite_shape004.png "A composite shape example" width=400px
175
176
177Composite shapes can be subsequently used for defining volumes.
178Moreover, these volumes contain other volumes, following the general
179criteria. Volumes created based on composite shapes cannot be divided.
180
181*/
182
183#include <iostream>
184#include "TRandom3.h"
185
186#include "TGeoManager.h"
187#include "TGeoMatrix.h"
188#include "TGeoBoolNode.h"
189
191#include "TVirtualViewer3D.h"
192#include "TBuffer3D.h"
193#include "TBuffer3DTypes.h"
194
195#include "TGeoCompositeShape.h"
197
198////////////////////////////////////////////////////////////////////////////////
199/// Needed just for cleanup.
200
202{
204}
205
206////////////////////////////////////////////////////////////////////////////////
207/// Needed just for cleanup.
208
210{
212}
213
214////////////////////////////////////////////////////////////////////////////////
215/// Default constructor
216
218 :TGeoBBox(0, 0, 0)
219{
221 fNode = 0;
222}
223
224////////////////////////////////////////////////////////////////////////////////
225/// Default constructor
226
227TGeoCompositeShape::TGeoCompositeShape(const char *name, const char *expression)
228 :TGeoBBox(0, 0, 0)
229{
231 SetName(name);
232 fNode = 0;
233 MakeNode(expression);
234 if (!fNode) {
235 Error("ctor", "Composite %s: cannot parse expression: %s", name, expression);
236 return;
237 }
238 ComputeBBox();
239}
240
241////////////////////////////////////////////////////////////////////////////////
242/// Default constructor
243
245 :TGeoBBox(0, 0, 0)
246{
248 fNode = 0;
249 MakeNode(expression);
250 if (!fNode) {
251 TString message = TString::Format("Composite (no name) could not parse expression %s", expression);
252 Error("ctor", "%s", message.Data());
253 return;
254 }
255 ComputeBBox();
256}
257
258////////////////////////////////////////////////////////////////////////////////
259/// Constructor with a Boolean node
260
262 :TGeoBBox(0,0,0)
263{
264 SetName(name);
265 fNode = node;
266 if (!fNode) {
267 Error("ctor", "Composite shape %s has null node", name);
268 return;
269 }
270 ComputeBBox();
271}
272
273////////////////////////////////////////////////////////////////////////////////
274/// destructor
275
277{
278 if (fNode) delete fNode;
279}
280
281////////////////////////////////////////////////////////////////////////////////
282/// Computes capacity of this shape [length^3] by sampling with 1% error.
283
285{
286 Double_t pt[3];
287 if (!gRandom) gRandom = new TRandom3();
288 Double_t vbox = 8*fDX*fDY*fDZ; // cm3
289 Int_t igen=0;
290 Int_t iin = 0;
291 while (iin<10000) {
292 pt[0] = fOrigin[0]-fDX+2*fDX*gRandom->Rndm();
293 pt[1] = fOrigin[1]-fDY+2*fDY*gRandom->Rndm();
294 pt[2] = fOrigin[2]-fDZ+2*fDZ*gRandom->Rndm();
295 igen++;
296 if (Contains(pt)) iin++;
297 }
298 Double_t capacity = iin*vbox/igen;
299 return capacity;
300}
301
302////////////////////////////////////////////////////////////////////////////////
303/// compute bounding box of the sphere
304
306{
308}
309
310////////////////////////////////////////////////////////////////////////////////
311/// Computes normal vector in POINT to the composite shape.
312
313void TGeoCompositeShape::ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
314{
315 if (fNode) fNode->ComputeNormal(point,dir,norm);
316}
317
318////////////////////////////////////////////////////////////////////////////////
319/// Tests if point is inside the shape.
320
322{
323 if (fNode) return fNode->Contains(point);
324 return kFALSE;
325}
326
327////////////////////////////////////////////////////////////////////////////////
328/// Compute closest distance from point px,py to each corner.
329
331{
332 const Int_t numPoints = GetNmeshVertices();
333 return ShapeDistancetoPrimitive(numPoints, px, py);
334}
335
336////////////////////////////////////////////////////////////////////////////////
337/// Compute distance from outside point to this composite shape.
338/// Check if the bounding box is crossed within the requested distance
339
341 Double_t step, Double_t *safe) const
342{
343 Double_t sdist = TGeoBBox::DistFromOutside(point,dir, fDX, fDY, fDZ, fOrigin, step);
344 if (sdist>=step) return TGeoShape::Big();
345 if (fNode) return fNode->DistFromOutside(point, dir, iact, step, safe);
346 return TGeoShape::Big();
347}
348
349////////////////////////////////////////////////////////////////////////////////
350/// Compute distance from inside point to outside of this composite shape.
351
353 Double_t step, Double_t *safe) const
354{
355 if (fNode) return fNode->DistFromInside(point, dir, iact, step, safe);
356 return TGeoShape::Big();
357}
358
359////////////////////////////////////////////////////////////////////////////////
360/// Divide all range of iaxis in range/step cells
361
362TGeoVolume *TGeoCompositeShape::Divide(TGeoVolume * /*voldiv*/, const char * /*divname*/, Int_t /*iaxis*/,
363 Int_t /*ndiv*/, Double_t /*start*/, Double_t /*step*/)
364{
365 Error("Divide", "Composite shapes cannot be divided");
366 return 0;
367}
368
369////////////////////////////////////////////////////////////////////////////////
370/// Returns numbers of vertices, segments and polygons composing the shape mesh.
371
372void TGeoCompositeShape::GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
373{
374 nvert = GetNmeshVertices();
375 nsegs = 0;
376 npols = 0;
377}
378
379////////////////////////////////////////////////////////////////////////////////
380/// print shape parameters
381
383{
384 printf("*** TGeoCompositeShape : %s = %s\n", GetName(), GetTitle());
385 printf(" Bounding box:\n");
387}
388
389////////////////////////////////////////////////////////////////////////////////
390/// Make a boolean node according to the top level boolean operation of expression.
391/// Propagates signal to branches until expression is fully decomposed.
392/// printf("Making node for : %s\n", expression);
393
394void TGeoCompositeShape::MakeNode(const char *expression)
395{
396 if (fNode) delete fNode;
397 fNode = 0;
398 SetTitle(expression);
399 TString sleft, sright, smat;
400 Int_t boolop;
401 boolop = TGeoManager::Parse(expression, sleft, sright, smat);
402 if (boolop<0) {
403 // fail
404 Error("MakeNode", "parser error");
405 return;
406 }
407 if (smat.Length())
408 Warning("MakeNode", "no geometrical transformation allowed at this level");
409 switch (boolop) {
410 case 0:
411 Error("MakeNode", "Expression has no boolean operation");
412 return;
413 case 1:
414 fNode = new TGeoUnion(sleft.Data(), sright.Data());
415 return;
416 case 2:
417 fNode = new TGeoSubtraction(sleft.Data(), sright.Data());
418 return;
419 case 3:
420 fNode = new TGeoIntersection(sleft.Data(), sright.Data());
421 }
422}
423
424////////////////////////////////////////////////////////////////////////////////
425/// Paint this composite shape into the current 3D viewer
426/// Returns bool flag indicating if the caller should continue to
427/// paint child objects
428
430{
431 Bool_t addChildren = kTRUE;
432
434 TVirtualViewer3D * viewer = gPad->GetViewer3D();
435 if (!painter || !viewer) return kFALSE;
436
437 if (fNode) {
438 // Fill out the buffer for the composite shape - nothing extra
439 // over TGeoBBox
440 Bool_t preferLocal = viewer->PreferLocalFrame();
441 if (TBuffer3D::GetCSLevel()) preferLocal = kFALSE;
444 preferLocal);
445
446 Bool_t paintComponents = kTRUE;
447
448 // Start a composite shape, identified by this buffer
450 paintComponents = viewer->OpenComposite(buffer, &addChildren);
451
453
454 // Paint the boolean node - will add more buffers to viewer
456 TGeoHMatrix backup(*matrix);
457 if (preferLocal) matrix->Clear();
458 if (paintComponents) fNode->Paint(option);
459 if (preferLocal) *matrix = backup;
460 // Close the composite shape
462 viewer->CloseComposite();
463 }
464
466}
467
468////////////////////////////////////////////////////////////////////////////////
469/// Register the shape and all components to TGeoManager class.
470
472{
473 if (gGeoManager->GetListOfShapes()->FindObject(this)) return;
475 TGeoMatrix *matrix;
476 TGeoShape *shape;
477 TGeoCompositeShape *comp;
478 if (fNode) {
479 matrix = fNode->GetLeftMatrix();
480 if (!matrix->IsRegistered()) matrix->RegisterYourself();
481 else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
483 }
484 matrix = fNode->GetRightMatrix();
485 if (!matrix->IsRegistered()) matrix->RegisterYourself();
486 else if (!gGeoManager->GetListOfMatrices()->FindObject(matrix)) {
488 }
489 shape = fNode->GetLeftShape();
490 if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
491 if (shape->IsComposite()) {
492 comp = (TGeoCompositeShape*)shape;
493 comp->RegisterYourself();
494 } else {
496 }
497 }
498 shape = fNode->GetRightShape();
499 if (!gGeoManager->GetListOfShapes()->FindObject(shape)) {
500 if (shape->IsComposite()) {
501 comp = (TGeoCompositeShape*)shape;
502 comp->RegisterYourself();
503 } else {
505 }
506 }
507 }
508}
509
510////////////////////////////////////////////////////////////////////////////////
511/// computes the closest distance from given point to this shape, according
512/// to option. The matching point on the shape is stored in spoint.
513
515{
516 if (fNode) return fNode->Safety(point,in);
517 return 0.;
518}
519
520////////////////////////////////////////////////////////////////////////////////
521/// Save a primitive as a C++ statement(s) on output stream "out".
522
523void TGeoCompositeShape::SavePrimitive(std::ostream &out, Option_t *option /*= ""*/)
524{
526 if (fNode) fNode->SavePrimitive(out,option);
527 out << " // Shape: " << GetName() << " type: " << ClassName() << std::endl;
528 out << " TGeoShape *" << GetPointerName() << " = new TGeoCompositeShape(\"" << GetName() << "\", pBoolNode);" << std::endl;
529 if (strlen(GetTitle())) out << " " << GetPointerName() << "->SetTitle(\"" << GetTitle() << "\");" << std::endl;
531}
532
533////////////////////////////////////////////////////////////////////////////////
534/// create points for a composite shape
535
537{
539}
540
541////////////////////////////////////////////////////////////////////////////////
542/// create points for a composite shape
543
545{
547}
548
549////////////////////////////////////////////////////////////////////////////////
550/// compute size of this 3D object
551
553{
554 if (fNode) fNode->Sizeof3D();
555}
556
557////////////////////////////////////////////////////////////////////////////////
558/// Return number of vertices of the mesh representation
559
561{
562 if (!fNode) return 0;
563 return fNode->GetNpoints();
564}
565
566////////////////////////////////////////////////////////////////////////////////
567/// Check the inside status for each of the points in the array.
568/// Input: Array of point coordinates + vector size
569/// Output: Array of Booleans for the inside of each point
570
571void TGeoCompositeShape::Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
572{
573 for (Int_t i=0; i<vecsize; i++) inside[i] = Contains(&points[3*i]);
574}
575
576////////////////////////////////////////////////////////////////////////////////
577/// Compute the normal for an array o points so that norm.dot.dir is positive
578/// Input: Arrays of point coordinates and directions + vector size
579/// Output: Array of normal directions
580
582{
583 for (Int_t i=0; i<vecsize; i++) ComputeNormal(&points[3*i], &dirs[3*i], &norms[3*i]);
584}
585
586////////////////////////////////////////////////////////////////////////////////
587/// Compute distance from array of input points having directions specified by dirs. Store output in dists
588
589void TGeoCompositeShape::DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
590{
591 for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromInside(&points[3*i], &dirs[3*i], 3, step[i]);
592}
593
594////////////////////////////////////////////////////////////////////////////////
595/// Compute distance from array of input points having directions specified by dirs. Store output in dists
596
597void TGeoCompositeShape::DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t* step) const
598{
599 for (Int_t i=0; i<vecsize; i++) dists[i] = DistFromOutside(&points[3*i], &dirs[3*i], 3, step[i]);
600}
601
602////////////////////////////////////////////////////////////////////////////////
603/// Compute safe distance from each of the points in the input array.
604/// Input: Array of point coordinates, array of statuses for these points, size of the arrays
605/// Output: Safety values
606
607void TGeoCompositeShape::Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
608{
609 for (Int_t i=0; i<vecsize; i++) safe[i] = Safety(&points[3*i], inside[i]);
610}
const Bool_t kFALSE
Definition: RtypesCore.h:101
float Float_t
Definition: RtypesCore.h:57
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassImp(name)
Definition: Rtypes.h:375
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t points
char name[80]
Definition: TGX11.cxx:110
R__EXTERN TGeoManager * gGeoManager
Definition: TGeoManager.h:602
R__EXTERN TRandom * gRandom
Definition: TRandom.h:62
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:458
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:819
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:1059
Base class for Boolean operations between two shapes.
Definition: TGeoBoolNode.h:26
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".
Create thread data for n threads max.
TGeoMatrix * GetRightMatrix() const
Definition: TGeoBoolNode.h:82
TGeoShape * GetLeftShape() const
Definition: TGeoBoolNode.h:83
void Paint(Option_t *option) override
Special schema for feeding the 3D buffers to the painter client.
TGeoMatrix * GetLeftMatrix() const
Definition: TGeoBoolNode.h:81
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:84
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
Composite shapes are Boolean combinations of two or more shape components.
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...
virtual void ClearThreadData() const
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:490
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:495
Int_t AddShape(const TGeoShape *shape)
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:49
virtual void SetTitle(const char *title="")
Set the title of the TNamed.
Definition: TNamed.cxx:164
const char * GetTitle() const override
Returns title of object.
Definition: TNamed.h:48
virtual void SetName(const char *name)
Set the name of the TNamed.
Definition: TNamed.cxx:140
TObject * FindObject(const char *name) const override
Find an object in this collection using its name.
Definition: TObjArray.cxx:415
void Add(TObject *obj) override
Definition: TObjArray.h:68
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:130
virtual void Warning(const char *method, const char *msgfmt,...) const
Issue warning message.
Definition: TObject.cxx:879
void SetBit(UInt_t f, Bool_t set)
Set or unset the user status bits as specified in f.
Definition: TObject.cxx:698
virtual void Error(const char *method, const char *msgfmt,...) const
Issue error message.
Definition: TObject.cxx:893
Random number generator class based on M.
Definition: TRandom3.h:27
Double_t Rndm() override
Machine independent random number generator.
Definition: TRandom.cxx:552
Basic string class.
Definition: TString.h:136
Ssiz_t Length() const
Definition: TString.h:410
const char * Data() const
Definition: TString.h:369
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:2341
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