Logo ROOT  
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 #include "TGeoShape.h"
16 
17 class TGeoBBox : public TGeoShape
18 {
19 protected :
20 // data members
21  Double_t fDX; // X half-length
22  Double_t fDY; // Y half-length
23  Double_t fDZ; // Z half-length
24  Double_t fOrigin[3]; // box origin
25 // methods
26  virtual void FillBuffer3D(TBuffer3D & buffer, Int_t reqSections, Bool_t localFrame) const;
27 public:
28  // constructors
30  TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
31  TGeoBBox(const char *name, Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
32  TGeoBBox(Double_t *param);
33  // destructor
34  virtual ~TGeoBBox();
35  // methods
36  static Bool_t AreOverlapping(const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2);
37  virtual Double_t Capacity() const;
38  virtual void ComputeBBox();
39  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
40  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
41  virtual Bool_t Contains(const Double_t *point) const;
42  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
43  static Bool_t Contains(const Double_t *point, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin);
44  virtual Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const;
45  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
46  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
47  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
48  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
49  static Double_t DistFromInside(const Double_t *point,const Double_t *dir,
50  Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big());
51  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
52  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
53  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
54  static Double_t DistFromOutside(const Double_t *point,const Double_t *dir,
55  Double_t dx, Double_t dy, Double_t dz, const Double_t *origin, Double_t stepmax=TGeoShape::Big());
56  virtual TGeoVolume *Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv,
57  Double_t start, Double_t step);
58  virtual const char *GetAxisName(Int_t iaxis) const;
59  virtual Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const;
60  virtual void GetBoundingCylinder(Double_t *param) const;
61  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
62  virtual Int_t GetByteCount() const {return 36;}
63  virtual Double_t GetFacetArea(Int_t index=0) const;
64  virtual Bool_t GetPointsOnFacet(Int_t index, Int_t npoints, Double_t *array) const;
65  virtual Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const;
66  virtual Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const;
67  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const;
68  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
69  virtual Int_t GetNmeshVertices() const {return 8;}
70  virtual Double_t GetDX() const {return fDX;}
71  virtual Double_t GetDY() const {return fDY;}
72  virtual Double_t GetDZ() const {return fDZ;}
73  virtual const Double_t *GetOrigin() const {return fOrigin;}
74  virtual void InspectShape() const;
75  virtual Bool_t IsCylType() const {return kFALSE;}
76  virtual Bool_t IsValidBox() const {return ((fDX<0)||(fDY<0)||(fDZ<0))?kFALSE:kTRUE;}
77  virtual Bool_t IsNullBox() const {return ((fDX<1.E-16)&&(fDY<1.E-16)&&(fDZ<1.E-16))?kTRUE:kFALSE;}
78  virtual TBuffer3D *MakeBuffer3D() const;
79  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
80  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
81  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
82  void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0);
83  virtual void SetDimensions(Double_t *param);
84  void SetBoxPoints(Double_t *points) const;
85  virtual void SetPoints(Double_t *points) const;
86  virtual void SetPoints(Float_t *points) const;
87  virtual void SetSegsAndPols(TBuffer3D &buffer) const;
88  virtual void Sizeof3D() const;
89 
90  ClassDef(TGeoBBox, 1) // box primitive
91 };
92 
93 #endif
TGeoShape.h
TGeoBBox::TGeoBBox
TGeoBBox()
Default constructor.
Definition: TGeoBBox.cxx:135
TGeoBBox::Safety
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:854
TGeoBBox::GetBuffer3D
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoBBox.cxx:1002
TGeoBBox::GetAxisRange
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:553
TGeoBBox::GetAxisName
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoBBox.cxx:536
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoBBox::GetMakeRuntimeShape
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:767
TGeoBBox::ComputeNormal
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal to closest surface from POINT.
Definition: TGeoBBox.cxx:237
TGeoBBox::IsValidBox
virtual Bool_t IsValidBox() const
Definition: TGeoBBox.h:82
TGeoBBox::GetMeshNumbers
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:782
TGeoBBox::AreOverlapping
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:188
TGeoBBox::DistFromInside_v
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...
Definition: TGeoBBox.cxx:1070
TGeoBBox::Safety_v
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:1088
TGeoBBox::fOrigin
Double_t fOrigin[3]
Definition: TGeoBBox.h:30
Float_t
float Float_t
Definition: RtypesCore.h:57
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoBBox::GetDZ
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:78
TGeoBBox::IsCylType
virtual Bool_t IsCylType() const
Definition: TGeoBBox.h:81
TGeoBBox::GetNmeshVertices
virtual Int_t GetNmeshVertices() const
Definition: TGeoBBox.h:75
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGeoBBox::~TGeoBBox
virtual ~TGeoBBox()
Destructor.
Definition: TGeoBBox.cxx:181
bool
TGeoBBox::Contains_v
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:1052
TGeoBBox::GetDX
virtual Double_t GetDX() const
Definition: TGeoBBox.h:76
TBuffer3D
Definition: TBuffer3D.h:17
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGeoShape
Definition: TGeoShape.h:25
TGeoBBox::InspectShape
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:792
TGeoBBox::fDY
Double_t fDY
Definition: TGeoBBox.h:28
TGeoBBox::GetBoundingCylinder
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoBBox.cxx:582
kFALSE
const Bool_t kFALSE
Definition: RtypesCore.h:92
TGeoBBox::GetByteCount
virtual Int_t GetByteCount() const
Definition: TGeoBBox.h:68
TGeoBBox::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoBBox.cxx:876
TGeoBBox::SetBoxDimensions
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
Definition: TGeoBBox.cxx:899
TGeoBBox::GetOrigin
virtual const Double_t * GetOrigin() const
Definition: TGeoBBox.h:79
TGeoBBox
Definition: TGeoBBox.h:17
TGeoBBox::SetDimensions
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:921
TGeoBBox::ComputeBBox
virtual void ComputeBBox()
Compute bounding box - nothing to do in this case.
Definition: TGeoBBox.cxx:332
TGeoBBox::FillBuffer3D
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:1032
TGeoBBox::DistFromOutside_v
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...
Definition: TGeoBBox.cxx:1078
TGeoBBox::fDZ
Double_t fDZ
Definition: TGeoBBox.h:29
TGeoBBox::GetFacetArea
virtual Double_t GetFacetArea(Int_t index=0) const
Get area in internal units of the facet with a given index.
Definition: TGeoBBox.cxx:596
TGeoBBox::SetBoxPoints
void SetBoxPoints(Double_t *points) const
Fill box vertices to an array.
Definition: TGeoBBox.cxx:939
Double_t
double Double_t
Definition: RtypesCore.h:59
TGeoMatrix
Definition: TGeoMatrix.h:40
TGeoBBox::Divide
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:288
TGeoBBox::Capacity
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoBBox.cxx:229
TGeoBBox::GetDY
virtual Double_t GetDY() const
Definition: TGeoBBox.h:77
points
point * points
Definition: X3DBuffer.c:22
TGeoBBox::IsNullBox
virtual Bool_t IsNullBox() const
Definition: TGeoBBox.h:83
TGeoBBox::CouldBeCrossed
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:252
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGeoBBox::GetPointsOnFacet
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:627
name
char name[80]
Definition: TGX11.cxx:110
TGeoBBox::GetFittingBox
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 successful.
Definition: TGeoBBox.cxx:727
TGeoBBox::ComputeNormal_v
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:1062
TGeoBBox::SetSegsAndPols
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fills TBuffer3D structure for segments and polygons.
Definition: TGeoBBox.cxx:820
TGeoBBox::Contains
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
Definition: TGeoBBox.cxx:339
TGeoShape::Big
static Double_t Big()
Definition: TGeoShape.h:88
TGeoBBox::Sizeof3D
virtual void Sizeof3D() const
Definition: TGeoBBox.cxx:995
TGeoBBox::DistFromOutside
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:429
TMath::E
constexpr Double_t E()
Base of natural log:
Definition: TMath.h:102
TGeoBBox::SetPoints
virtual void SetPoints(Double_t *points) const
Fill box points.
Definition: TGeoBBox.cxx:947
TGeoBBox::GetPointsOnSegments
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:690
TGeoVolume
Definition: TGeoVolume.h:44
TGeoBBox::fDX
Double_t fDX
Definition: TGeoBBox.h:27
TGeoBBox::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoBBox.cxx:276
TGeoBBox::DistFromInside
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:363
int
TGeoBBox::MakeBuffer3D
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoBBox.cxx:805