Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
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 {
18protected:
19 // data members
20 Double_t fDX; // X half-length
21 Double_t fDY; // Y half-length
22 Double_t fDZ; // Z half-length
23 Double_t fOrigin[3]; // box origin
24 // methods
25 void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override;
26
27 TGeoBBox(const TGeoBBox &) = delete;
28 TGeoBBox &operator=(const TGeoBBox &) = delete;
29
30public:
31 // constructors
32 TGeoBBox();
33 TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
34 TGeoBBox(const char *name, Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
35 TGeoBBox(Double_t *param);
36 // destructor
37 ~TGeoBBox() override;
38 // methods
39 static Bool_t
40 AreOverlapping(const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2)
41 R__DEPRECATED(6, 34, "DEPRECATED, DO NOT USE ! The overlap detection does not work for all cases");
42
43 Double_t Capacity() const override;
44 void ComputeBBox() override;
45 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
46 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
47 Bool_t Contains(const Double_t *point) const override;
48 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
49 static Bool_t Contains(const Double_t *point, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin);
50 Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override;
51 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
52 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
53 Double_t *safe = nullptr) const override;
54 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
55 Double_t *step) const override;
56 static Double_t DistFromInside(const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz,
57 const Double_t *origin, Double_t stepmax = TGeoShape::Big());
58 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
59 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
60 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
61 Double_t *step) const override;
62 static Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz,
63 const Double_t *origin, Double_t stepmax = TGeoShape::Big());
65 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
66 const char *GetAxisName(Int_t iaxis) const override;
67 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
68 void GetBoundingCylinder(Double_t *param) const override;
69 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
70 Int_t GetByteCount() const override { return 36; }
71 virtual Double_t GetFacetArea(Int_t index = 0) const;
72 virtual Bool_t GetPointsOnFacet(Int_t index, Int_t npoints, Double_t *array) const;
73 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override;
74 Int_t
75 GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override;
76 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
77 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
78 Int_t GetNmeshVertices() const override { return 8; }
79 virtual Double_t GetDX() const { return fDX; }
80 virtual Double_t GetDY() const { return fDY; }
81 virtual Double_t GetDZ() const { return fDZ; }
82 virtual const Double_t *GetOrigin() const { return fOrigin; }
83 void InspectShape() const override;
84 Bool_t IsCylType() const override { return kFALSE; }
85 Bool_t IsValidBox() const override { return ((fDX < 0) || (fDY < 0) || (fDZ < 0)) ? kFALSE : kTRUE; }
86 virtual Bool_t IsNullBox() const { return ((fDX < 1.E-16) && (fDY < 1.E-16) && (fDZ < 1.E-16)) ? kTRUE : kFALSE; }
87 TBuffer3D *MakeBuffer3D() const override;
88 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
89 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
90 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
91 void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
92 void SetDimensions(Double_t *param) override;
93 void SetBoxPoints(Double_t *points) const;
94 void SetPoints(Double_t *points) const override;
95 void SetPoints(Float_t *points) const override;
96 void SetSegsAndPols(TBuffer3D &buffer) const override;
97 void Sizeof3D() const override;
98
99 ClassDefOverride(TGeoBBox, 1) // box primitive
100};
101
102#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:521
bool Bool_t
Definition RtypesCore.h:63
int Int_t
Definition RtypesCore.h:45
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kFALSE
Definition RtypesCore.h:101
double Double_t
Definition RtypesCore.h:59
constexpr Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition Rtypes.h:341
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 Rectangle_t WindowAttributes_t index
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
Generic 3D primitive description class.
Definition TBuffer3D.h:18
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...
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
Definition TGeoBBox.cxx:990
virtual const Double_t * GetOrigin() const
Definition TGeoBBox.h:82
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 surface of the box.
Definition TGeoBBox.cxx:399
Double_t fDX
Definition TGeoBBox.h:20
const char * GetAxisName(Int_t iaxis) const override
Returns name of axis IAXIS.
Definition TGeoBBox.cxx:603
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...
static Bool_t AreOverlapping(const TGeoBBox *box1, const TGeoMatrix *mat1, const TGeoBBox *box2, const TGeoMatrix *mat2) R__DEPRECATED(6
Check if 2 positioned boxes overlap.
Definition TGeoBBox.cxx:213
void GetBoundingCylinder(Double_t *param) const override
Fill vector param[4] with the bounding cylinder parameters.
Definition TGeoBBox.cxx:645
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:682
void SetPoints(Double_t *points) const override
Fill box points.
void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin=nullptr)
Set parameters of the box.
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:477
TGeoBBox(const TGeoBBox &)=delete
Double_t Capacity() const override
Computes capacity of the shape in [length^3].
Definition TGeoBBox.cxx:256
virtual Double_t GetDX() const
Definition TGeoBBox.h:79
virtual Double_t GetFacetArea(Int_t index=0) const
Get area in internal units of the facet with a given index.
Definition TGeoBBox.cxx:659
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Compute closest distance from point px,py to each corner.
Definition TGeoBBox.cxx:309
Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override
Decides fast if the bounding box could be crossed by a vector.
Definition TGeoBBox.cxx:279
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 SetBoxPoints(Double_t *points) const
Fill box vertices to an array.
Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override
Fills array with n random points located on the line segments of the shape mesh.
Definition TGeoBBox.cxx:748
virtual Double_t GetDZ() const
Definition TGeoBBox.h:81
virtual Double_t GetDY() const
Definition TGeoBBox.h:80
Int_t GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override
Fills real parameters of a positioned box inside this one. Returns 0 if successful.
Definition TGeoBBox.cxx:788
static Bool_t DEPRECATED
Definition TGeoBBox.h:41
Double_t fOrigin[3]
Definition TGeoBBox.h:23
Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override
Get range of shape for a given axis.
Definition TGeoBBox.cxx:616
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
Computes normal to closest surface from POINT.
Definition TGeoBBox.cxx:264
TBuffer3D * MakeBuffer3D() const override
Creates a TBuffer3D describing this shape.
Definition TGeoBBox.cxx:868
void InspectShape() const override
Prints shape parameters.
Definition TGeoBBox.cxx:855
Bool_t IsValidBox() const override
Definition TGeoBBox.h:85
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...
Bool_t Contains(const Double_t *point) const override
Test if point is inside this shape.
Definition TGeoBBox.cxx:368
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
Computes the closest distance from given point to this shape.
Definition TGeoBBox.cxx:964
static Bool_t DO NOT USE !The overlap detection does not work for all cases
Definition TGeoBBox.h:41
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
Returns numbers of vertices, segments and polygons composing the shape mesh.
Definition TGeoBBox.cxx:845
void Sizeof3D() const override
TGeoShape * GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Definition TGeoBBox.cxx:829
Int_t GetByteCount() const override
Definition TGeoBBox.h:70
virtual Bool_t IsNullBox() const
Definition TGeoBBox.h:86
Double_t fDY
Definition TGeoBBox.h:21
void SetSegsAndPols(TBuffer3D &buffer) const override
Fills TBuffer3D structure for segments and polygons.
Definition TGeoBBox.cxx:882
void SetDimensions(Double_t *param) override
Set dimensions based on the array of parameters param[0] - half-length in x param[1] - half-length in...
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Fills a static 3D buffer and returns a reference.
Int_t GetNmeshVertices() const override
Definition TGeoBBox.h:78
Double_t fDZ
Definition TGeoBBox.h:22
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...
~TGeoBBox() override
Destructor.
Definition TGeoBBox.cxx:207
TGeoBBox & operator=(const TGeoBBox &)=delete
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 ComputeBBox() override
Compute bounding box - nothing to do in this case.
Definition TGeoBBox.cxx:363
TGeoVolume * Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override
Divide this box shape belonging to volume "voldiv" into ndiv equal volumes called divname,...
Definition TGeoBBox.cxx:322
Bool_t IsCylType() const override
Definition TGeoBBox.h:84
TGeoBBox()
Default constructor.
Definition TGeoBBox.cxx:164
Geometrical transformation package.
Definition TGeoMatrix.h:38
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:87
TGeoVolume, TGeoVolumeMulti, TGeoVolumeAssembly are the volume classes.
Definition TGeoVolume.h:43
for(Int_t i=0;i< n;i++)
Definition legend1.C:18