ROOT  6.06/09
Reference Guide
TGeoBBox.h
Go to the documentation of this file.
1 // @(#)root/geom:$Id$
2 // Author: Andrei Gheata 24/10/01
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 #ifndef ROOT_TGeoBBox
13 #define ROOT_TGeoBBox
14 
15 #ifndef ROOT_TGeoShape
16 #include "TGeoShape.h"
17 #endif
18 
19 ///////////////////////////////////////////////////////////////////////////////
20 // //
21 // TGeoBBox - box class. All shape primitives inherit from this, their //
22 // constructor filling automatically the parameters of the box that bounds //
23 // the given shape. Defined by 6 parameters : //
24 // fDX, fDY, fDZ - half lengths on X, Y and Z axis //
25 // fOrigin[3] - position of box origin //
26 // //
27 ///////////////////////////////////////////////////////////////////////////////
28 
29 class TGeoBBox : public TGeoShape
30 {
31 protected :
32 // data members
33  Double_t fDX; // X half-length
34  Double_t fDY; // Y half-length
35  Double_t fDZ; // Z half-length
36  Double_t fOrigin[3]; // box origin
37 // methods
38  virtual void FillBuffer3D(TBuffer3D & buffer, Int_t reqSections, Bool_t localFrame) const;
39 public:
40  // constructors
41  TGeoBBox();
42  TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
43  TGeoBBox(const char *name, Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
44  TGeoBBox(Double_t *param);
45  // destructor
46  virtual ~TGeoBBox();
47  // methods
48  static Bool_t AreOverlapping(const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2);
49  virtual Double_t Capacity() const;
50  virtual void ComputeBBox();
51  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
52  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
53  virtual Bool_t Contains(const Double_t *point) const;
54  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
55  static Bool_t Contains(const Double_t *point, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin);
56  virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const;
57  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
58  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
59  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
60  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
61  static Double_t DistFromInside(const Double_t *point,const Double_t *dir,
62  Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big());
63  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
64  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
65  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
66  static Double_t DistFromOutside(const Double_t *point,const Double_t *dir,
67  Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big());
68  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
69  Double_t start, Double_t step);
70  virtual const char *GetAxisName(Int_t iaxis) const;
71  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
72  virtual void GetBoundingCylinder(Double_t *param) const;
73  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
74  virtual Int_t GetByteCount() const {return 36;}
75  virtual Double_t GetFacetArea(Int_t index=0) const;
76  virtual Bool_t GetPointsOnFacet(Int_t index, Int_t npoints, Double_t *array) const;
77  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
78  virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const;
79  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
80  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
81  virtual Int_t GetNmeshVertices() const {return 8;}
82  virtual Double_t GetDX() const {return fDX;}
83  virtual Double_t GetDY() const {return fDY;}
84  virtual Double_t GetDZ() const {return fDZ;}
85  virtual const Double_t *GetOrigin() const {return fOrigin;}
86  virtual void InspectShape() const;
87  virtual Bool_t IsCylType() const {return kFALSE;}
88  virtual Bool_t IsValidBox() const {return ((fDX<0)||(fDY<0)||(fDZ<0))?kFALSE:kTRUE;}
89  virtual Bool_t IsNullBox() const {return ((fDX<1.E-16)&&(fDY<1.E-16)&&(fDZ<1.E-16))?kTRUE:kFALSE;}
90  virtual TBuffer3D *MakeBuffer3D() const;
91  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
92  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
93  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
94  void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
95  virtual void SetDimensions(Double_t *param);
96  void SetBoxPoints(Double_t *points) const;
97  virtual void SetPoints(Double_t *points) const;
98  virtual void SetPoints(Float_t *points) const;
99  virtual void SetSegsAndPols(TBuffer3D &buffer) const;
100  virtual void Sizeof3D() const;
101 
102  ClassDef(TGeoBBox, 1) // box primitive
103 };
104 
105 #endif
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal to closest surface from POINT.
Definition: TGeoBBox.cxx:194
static Bool_t AreOverlapping(const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2)
Check if 2 positioned boxes overlap.
Definition: TGeoBBox.cxx:145
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fills TBuffer3D structure for segments and polygons.
Definition: TGeoBBox.cxx:777
virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const
Fills array with n random points located on the line segments of the shape mesh.
Definition: TGeoBBox.cxx:647
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoBBox.cxx:762
float Float_t
Definition: RtypesCore.h:53
virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize)
Compute the normal for an array o points so that norm.dot.dir is positive Input: Arrays of point coor...
Definition: TGeoBBox.cxx:1019
virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const
Check the inside status for each of the points in the array.
Definition: TGeoBBox.cxx:1009
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 specisied by dirs. Store output in dist...
Definition: TGeoBBox.cxx:1027
const char Option_t
Definition: RtypesCore.h:62
virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition: TGeoBBox.cxx:739
Double_t fOrigin[3]
Definition: TGeoBBox.h:36
int Int_t
Definition: RtypesCore.h:41
bool Bool_t
Definition: RtypesCore.h:59
const Bool_t kFALSE
Definition: Rtypes.h:92
virtual Double_t GetDY() const
Definition: TGeoBBox.h:83
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:386
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:84
virtual void ComputeBBox()
Compute bounding box - nothing to do in this case.
Definition: TGeoBBox.cxx:289
virtual Bool_t IsValidBox() const
Definition: TGeoBBox.h:88
virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const
Compute safe distance from each of the points in the input array.
Definition: TGeoBBox.cxx:1045
Double_t fDZ
Definition: TGeoBBox.h:35
#define ClassDef(name, id)
Definition: Rtypes.h:254
virtual Bool_t IsCylType() const
Definition: TGeoBBox.h:87
virtual void SetPoints(Double_t *points) const
Fill box points.
Definition: TGeoBBox.cxx:904
virtual Int_t GetByteCount() const
Definition: TGeoBBox.h:74
char * out
Definition: TBase64.cxx:29
virtual const Double_t * GetOrigin() const
Definition: TGeoBBox.h:85
virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const
Fills real parameters of a positioned box inside this one. Returns 0 if successfull.
Definition: TGeoBBox.cxx:684
point * points
Definition: X3DBuffer.c:20
virtual Double_t GetFacetArea(Int_t index=0) const
Get area in internal units of the facet with a given index.
Definition: TGeoBBox.cxx:553
virtual Double_t GetDX() const
Definition: TGeoBBox.h:82
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const
In case shape has some negative parameters, these has to be computed in order to fit the mother...
Definition: TGeoBBox.cxx:724
void SetBoxPoints(Double_t *points) const
Fill box vertices to an array.
Definition: TGeoBBox.cxx:896
virtual ~TGeoBBox()
Destructor.
Definition: TGeoBBox.cxx:138
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoBBox.cxx:539
Double_t E()
Definition: TMath.h:54
Generic 3D primitive description class.
Definition: TBuffer3D.h:19
virtual void SetDimensions(Double_t *param)
Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in...
Definition: TGeoBBox.cxx:878
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
Computes the closest distance from given point to this shape.
Definition: TGeoBBox.cxx:811
virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const
Get range of shape for a given axis.
Definition: TGeoBBox.cxx:510
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoBBox.cxx:186
virtual Int_t GetNmeshVertices() const
Definition: TGeoBBox.h:81
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoBBox.cxx:959
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
Definition: TGeoBBox.cxx:856
virtual Bool_t IsNullBox() const
Definition: TGeoBBox.h:89
virtual TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step)
— Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname...
Definition: TGeoBBox.cxx:245
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:749
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoBBox.cxx:833
double Double_t
Definition: RtypesCore.h:55
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:989
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoBBox.cxx:493
static Double_t Big()
Definition: TGeoShape.h:98
Double_t fDY
Definition: TGeoBBox.h:34
#define name(a, b)
Definition: linkTestLib0.cpp:5
virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const
Decides fast if the bounding box could be crossed by a vector.
Definition: TGeoBBox.cxx:209
virtual Bool_t GetPointsOnFacet(Int_t index, Int_t npoints, Double_t *array) const
Fills array with n random points located on the surface of indexed facet.
Definition: TGeoBBox.cxx:584
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 specisied by dirs. Store output in dist...
Definition: TGeoBBox.cxx:1035
Double_t fDX
Definition: TGeoBBox.h:33
virtual void Sizeof3D() const
Definition: TGeoBBox.cxx:952
const Bool_t kTRUE
Definition: Rtypes.h:91
double norm(double *x, double *p)
Definition: unuranDistr.cxx:40
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
Definition: TGeoBBox.cxx:296
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoBBox.cxx:233
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 surface of the box.
Definition: TGeoBBox.cxx:320