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