File indexing completed on 2026-08-07 09:27:09
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012 #ifndef ROOT_TGeoBBox
0013 #define ROOT_TGeoBBox
0014
0015 #include "TGeoShape.h"
0016 #include "Math/Vector3D.h"
0017
0018 class TGeoBBox : public TGeoShape {
0019 protected:
0020
0021 Double_t fDX;
0022 Double_t fDY;
0023 Double_t fDZ;
0024 Double_t fOrigin[3];
0025
0026 void FillBuffer3D(TBuffer3D &buffer, Int_t reqSections, Bool_t localFrame) const override;
0027
0028 TGeoBBox(const TGeoBBox &) = delete;
0029 TGeoBBox &operator=(const TGeoBBox &) = delete;
0030
0031 public:
0032
0033 TGeoBBox();
0034 TGeoBBox(Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
0035 TGeoBBox(const char *name, Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
0036 TGeoBBox(Double_t *param);
0037
0038 ~TGeoBBox() override;
0039
0040
0041 Double_t Capacity() const override;
0042 void ComputeBBox() override;
0043 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) const override;
0044 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
0045 Bool_t Contains(const Double_t *point) const override;
0046 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
0047 static Bool_t Contains(const Double_t *point, Double_t dx, Double_t dy, Double_t dz, const Double_t *origin);
0048 Bool_t CouldBeCrossed(const Double_t *point, const Double_t *dir) const override;
0049 Int_t DistancetoPrimitive(Int_t px, Int_t py) override;
0050 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
0051 Double_t *safe = nullptr) const override;
0052 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0053 Double_t *step) const override;
0054 static Double_t DistFromInside(const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz,
0055 const Double_t *origin, Double_t stepmax = TGeoShape::Big());
0056 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
0057 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
0058 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
0059 Double_t *step) const override;
0060 static Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Double_t dx, Double_t dy, Double_t dz,
0061 const Double_t *origin, Double_t stepmax = TGeoShape::Big());
0062 TGeoVolume *
0063 Divide(TGeoVolume *voldiv, const char *divname, Int_t iaxis, Int_t ndiv, Double_t start, Double_t step) override;
0064 const char *GetAxisName(Int_t iaxis) const override;
0065 Double_t GetAxisRange(Int_t iaxis, Double_t &xlo, Double_t &xhi) const override;
0066 void GetBoundingCylinder(Double_t *param) const override;
0067 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
0068 Int_t GetByteCount() const override { return 36; }
0069 inline ROOT::Math::XYZVector GetDimensions() const { return ROOT::Math::XYZVector(fDX, fDY, fDZ); }
0070 virtual Double_t GetFacetArea(Int_t index = 0) const;
0071 virtual Bool_t GetPointsOnFacet(Int_t index, Int_t npoints, Double_t *array) const;
0072 Bool_t GetPointsOnSegments(Int_t npoints, Double_t *array) const override;
0073 Int_t
0074 GetFittingBox(const TGeoBBox *parambox, TGeoMatrix *mat, Double_t &dx, Double_t &dy, Double_t &dz) const override;
0075 TGeoShape *GetMakeRuntimeShape(TGeoShape *mother, TGeoMatrix *mat) const override;
0076 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
0077 Int_t GetNmeshVertices() const override { return 8; }
0078 virtual Double_t GetDX() const { return fDX; }
0079 virtual Double_t GetDY() const { return fDY; }
0080 virtual Double_t GetDZ() const { return fDZ; }
0081 virtual const Double_t *GetOrigin() const { return fOrigin; }
0082 ROOT::Math::XYZVector GetWorldCenter(const TGeoMatrix *m) const;
0083 void InspectShape() const override;
0084 Bool_t IsConvex() const override { return kTRUE; }
0085 Bool_t IsCylType() const override { return kFALSE; }
0086 Bool_t IsValidBox() const override { return ((fDX < 0) || (fDY < 0) || (fDZ < 0)) ? kFALSE : kTRUE; }
0087 virtual Bool_t IsNullBox() const { return ((fDX < 1.E-16) && (fDY < 1.E-16) && (fDZ < 1.E-16)) ? kTRUE : kFALSE; }
0088 static Bool_t IsSeparatingAxis(const ROOT::Math::XYZVector &L, const ROOT::Math::XYZVector &D,
0089 const ROOT::Math::XYZVector &Ax, const ROOT::Math::XYZVector &Ay,
0090 const ROOT::Math::XYZVector &Az, const ROOT::Math::XYZVector &Bx,
0091 const ROOT::Math::XYZVector &By, const ROOT::Math::XYZVector &Bz,
0092 const ROOT::Math::XYZVector &dA, const ROOT::Math::XYZVector &dB, Double_t tol);
0093 TBuffer3D *MakeBuffer3D() const override;
0094 static bool MayIntersect(const TGeoBBox *boxA, const TGeoMatrix *mA, const TGeoBBox *boxB, const TGeoMatrix *mB);
0095 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
0096 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
0097 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
0098 void SetBoxDimensions(Double_t dx, Double_t dy, Double_t dz, Double_t *origin = nullptr);
0099 void SetDimensions(Double_t *param) override;
0100 void SetBoxPoints(Double_t *points) const;
0101 void SetPoints(Double_t *points) const override;
0102 void SetPoints(Float_t *points) const override;
0103 void SetSegsAndPols(TBuffer3D &buffer) const override;
0104 void Sizeof3D() const override;
0105
0106 ClassDefOverride(TGeoBBox, 1)
0107 };
0108
0109 #endif