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
17class TGeoBBox : public TGeoShape
18{
19protected :
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;
27public:
28 // constructors
29 TGeoBBox();
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
int Int_t
Definition: RtypesCore.h:41
const Bool_t kFALSE
Definition: RtypesCore.h:88
bool Bool_t
Definition: RtypesCore.h:59
double Double_t
Definition: RtypesCore.h:55
float Float_t
Definition: RtypesCore.h:53
const Bool_t kTRUE
Definition: RtypesCore.h:87
const char Option_t
Definition: RtypesCore.h:62
#define ClassDef(name, id)
Definition: Rtypes.h:326
char name[80]
Definition: TGX11.cxx:109
point * points
Definition: X3DBuffer.c:22
Generic 3D primitive description class.
Definition: TBuffer3D.h:18
Box class.
Definition: TGeoBBox.h:18
virtual const Double_t * GetOrigin() const
Definition: TGeoBBox.h:73
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:783
Double_t fDX
Definition: TGeoBBox.h:21
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:628
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:855
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:728
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:430
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:289
virtual void InspectShape() const
Prints shape parameters.
Definition: TGeoBBox.cxx:793
virtual Double_t GetDX() const
Definition: TGeoBBox.h:70
virtual Double_t GetFacetArea(Int_t index=0) const
Get area in internal units of the facet with a given index.
Definition: TGeoBBox.cxx:597
void SetBoxPoints(Double_t *points) const
Fill box vertices to an array.
Definition: TGeoBBox.cxx:940
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:554
virtual Double_t GetDZ() const
Definition: TGeoBBox.h:72
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:1053
virtual void Sizeof3D() const
Definition: TGeoBBox.cxx:996
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:768
virtual Int_t GetNmeshVertices() const
Definition: TGeoBBox.h:69
virtual Double_t GetDY() const
Definition: TGeoBBox.h:71
virtual void ComputeBBox()
Compute bounding box - nothing to do in this case.
Definition: TGeoBBox.cxx:333
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:1089
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:189
Double_t fOrigin[3]
Definition: TGeoBBox.h:24
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:1071
virtual ~TGeoBBox()
Destructor.
Definition: TGeoBBox.cxx:182
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:1063
virtual Double_t Capacity() const
Computes capacity of the shape in [length^3].
Definition: TGeoBBox.cxx:230
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
Compute closest distance from point px,py to each corner.
Definition: TGeoBBox.cxx:277
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:1079
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:253
virtual Bool_t IsNullBox() const
Definition: TGeoBBox.h:77
Double_t fDY
Definition: TGeoBBox.h:22
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoBBox.cxx:1003
virtual Int_t GetByteCount() const
Definition: TGeoBBox.h:62
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:691
virtual Bool_t IsCylType() const
Definition: TGeoBBox.h:75
virtual const char * GetAxisName(Int_t iaxis) const
Returns name of axis IAXIS.
Definition: TGeoBBox.cxx:537
virtual void SetSegsAndPols(TBuffer3D &buffer) const
Fills TBuffer3D structure for segments and polygons.
Definition: TGeoBBox.cxx:821
virtual Bool_t Contains(const Double_t *point) const
Test if point is inside this shape.
Definition: TGeoBBox.cxx:340
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoBBox.cxx:877
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:1033
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=0)
Set parameters of the box.
Definition: TGeoBBox.cxx:900
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:364
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoBBox.cxx:806
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Computes normal to closest surface from POINT.
Definition: TGeoBBox.cxx:238
TGeoBBox()
Default constructor.
Definition: TGeoBBox.cxx:136
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:922
virtual void GetBoundingCylinder(Double_t *param) const
Fill vector param[4] with the bounding cylinder parameters.
Definition: TGeoBBox.cxx:583
virtual Bool_t IsValidBox() const
Definition: TGeoBBox.h:76
virtual void SetPoints(Double_t *points) const
Fill box points.
Definition: TGeoBBox.cxx:948
Geometrical transformation package.
Definition: TGeoMatrix.h:41
Base abstract class for all shapes.
Definition: TGeoShape.h:26
static Double_t Big()
Definition: TGeoShape.h:88
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition: TGeoVolume.h:47