TGeoCompositeShape
class description - source file - inheritance tree
public:
TGeoCompositeShape()
TGeoCompositeShape(const char* name, const char* expression)
TGeoCompositeShape(const char* expression)
TGeoCompositeShape(const TGeoCompositeShape&)
virtual ~TGeoCompositeShape()
static TClass* Class()
virtual void ComputeBBox()
virtual Bool_t Contains(Double_t* point) const
virtual Double_t DistToIn(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = 0, Double_t* safe = 0) const
virtual Double_t DistToOut(Double_t* point, Double_t* dir, Int_t iact = 1, Double_t step = 0, Double_t* safe = 0) const
virtual Double_t DistToSurf(Double_t* point, Double_t* dir) const
virtual TGeoVolume* Divide(TGeoVolume* voldiv, const char* divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
TGeoBoolNode* GetBoolNode() const
virtual void GetBoundingCylinder(Double_t*) const
virtual TGeoShape* GetMakeRuntimeShape(TGeoShape*, TGeoMatrix*) const
virtual void InspectShape() const
virtual TClass* IsA() const
virtual Bool_t IsComposite() const
virtual Bool_t IsCylType() const
void MakeNode(const char* expression)
virtual void NextCrossing(TGeoParamCurve* c, Double_t* point) const
virtual void Paint(Option_t* option)
virtual void PaintNext(TGeoHMatrix* glmat, Option_t* option)
virtual Double_t Safety(Double_t* point, Bool_t in = kTRUE) const
virtual void SetDimensions(Double_t*)
virtual void SetPoints(Double_t* buff) const
virtual void SetPoints(Float_t* buff) const
virtual void ShowMembers(TMemberInspector& insp, char* parent)
virtual void Sizeof3D() const
virtual void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
private:
TGeoBoolNode* fNode top boolean node
TGeoCompositeShape - class handling Boolean composition of shapes
Composite shapes are Boolean combination of two or more shape
components. The supported boolean operations are union (+), intersection (*)
and subtraction. Composite shapes derive from the base TGeoShape class,
therefore providing all shape features : computation of bounding box, finding
if a given point is inside or outside the combination, as well as computing the
distance to entering/exiting. It can be directly used for creating volumes or
used in the definition of other composite shapes.
Composite shapes are provided in order to complement and extend the set of
basic shape primitives. They have a binary tree internal structure, therefore
all shape-related geometry queries are signals propagated from top level down
to the final leaves, while the provided answers are assembled and interpreted
back at top. This CSG hierarchy is effective for small number of components,
while performance drops dramatically for large structures. Building a complete
geometry in this style is virtually possible but highly not recommended.
Structure of composite shapes
A composite shape can always be regarded as the result of a Boolean operation
between only two shape components. All information identifying these two
components as well as their positions with respect to the frame of the composite
is represented by an object called Boolean node. A composite shape just have
a pointer to such a Boolean node. Since the shape components may also be
composites, they will also contain binary Boolean nodes branching other two
shapes in the hierarcy. Any such branch ends-up when the final leaves are no
longer composite shapes, but basic primitives.
/*
*/
Suppose that A, B, C and D represent basic shapes, we will illustrate
how the internal representation of few combinations look like. We do this
only for the sake of understanding how to create them in a proper way, since
the user interface for this purpose is in fact very simple. We will ignore
for the time being the positioning of components. The definition of a composite
shape takes an expression where the identifiers are shape names. The
expression is parsed and decomposed in 2 sub-expressions and the top-level
Boolean operator.
1. A+B+C
This represent the union of A, B and C. Both union operators are at the
same level. Since:
A+B+C = (A+B)+C = A+(B+C)
the first (+) is taken as separator, hence the expression splitted:
A and B+C
A Boolean node of type TGeoUnion("A", "B+C") is created. This tries to replace
the 2 expressions by actual pointers to corresponding shapes.
The first expression (A) contains no operators therefore is interpreted as
representing a shape. The shape named "A" is searched into the list of shapes
handled by the manager class and stored as the "left" shape in the Boolean
union node. Since the second expression is not yet fully decomposed, the "right"
shape in the combination is created as a new composite shape. This will split
at its turn B+C into B and C and create a TGeoUnion("B","C"). The B and C
identifiers will be looked for and replaced by the pointers to the actual shapes
into the new node. Finally, the composite "A+B+C" will be represented as:
TGeoCompositeShape()
:TGeoBBox(0, 0, 0)
Default constructor
TGeoCompositeShape(const char *name, const char *expression)
:TGeoBBox(0, 0, 0)
Default constructor
TGeoCompositeShape(const char *expression)
:TGeoBBox(0, 0, 0)
Default constructor
~TGeoCompositeShape()
destructor
void ComputeBBox()
compute bounding box of the sphere
Bool_t Contains(Double_t *point) const
test if point is inside this sphere
Double_t DistToIn(Double_t *point, Double_t *dir, Int_t iact,
Double_t step, Double_t *safe) const
Compute distance from outside point to this composite shape.
Double_t DistToOut(Double_t *point, Double_t *dir, Int_t iact,
Double_t step, Double_t *safe) const
Compute distance from inside point to outside of this composite shape.
Double_t DistToSurf(Double_t * /*point*/, Double_t * /*dir*/) const
computes the distance to next surface of the sphere along a ray
starting from given point to the given direction.
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
void InspectShape() const
print shape parameters
void MakeNode(const char *expression)
Make a booleann node according to the top level boolean operation of expression.
Propagates signal to branches until expression is fully decomposed.
void NextCrossing(TGeoParamCurve * /*c*/, Double_t * /*point*/) const
computes next intersection point of curve c with this shape
void Paint(Option_t *option)
paint this shape according to option
void PaintNext(TGeoHMatrix *glmat, Option_t *option)
paint this shape according to option
Double_t Safety(Double_t * /*point*/, Bool_t /*in*/) const
computes the closest distance from given point to this shape, according
to option. The matching point on the shape is stored in spoint.
void SetPoints(Double_t *buff) const
create points for a composite shape
void SetPoints(Float_t *buff) const
create points for a composite shape
void Sizeof3D() const
compute size of this 3D object
Inline Functions
TGeoBoolNode* GetBoolNode() const
void GetBoundingCylinder(Double_t*) const
TGeoShape* GetMakeRuntimeShape(TGeoShape*, TGeoMatrix*) const
Bool_t IsComposite() const
Bool_t IsCylType() const
void SetDimensions(Double_t*)
TClass* Class()
TClass* IsA() const
void ShowMembers(TMemberInspector& insp, char* parent)
void Streamer(TBuffer& b)
void StreamerNVirtual(TBuffer& b)
TGeoCompositeShape TGeoCompositeShape(const TGeoCompositeShape&)
Author: Andrei Gheata 31/01/02
Last update: root/geom:$Name: $:$Id: TGeoCompositeShape.cxx,v 1.11 2003/06/17 09:13:55 brun Exp $
Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.