Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
TGeoXtru.h
Go to the documentation of this file.
1// @(#)root/geom:$Id$
2// Author: Mihaela Gheata 24/01/04
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_TGeoXtru
13#define ROOT_TGeoXtru
14
15#include "TGeoBBox.h"
16
17#include <mutex>
18#include <vector>
19
20class TGeoPolygon;
21
22class TGeoXtru : public TGeoBBox {
23public:
24 struct ThreadData_t {
25 Int_t fSeg; // !current segment [0,fNvert-1]
26 Int_t fIz; // !current z plane [0,fNz-1]
27 Double_t *fXc; // ![fNvert] current X positions for polygon vertices
28 Double_t *fYc; // ![fNvert] current Y positions for polygon vertices
29 TGeoPolygon *fPoly; // !polygon defining section shape
30
33 };
35 void ClearThreadData() const override;
36 void CreateThreadData(Int_t nthreads) override;
37
38protected:
39 // data members
40 Int_t fNvert; // number of vertices of the 2D polygon (at least 3)
41 Int_t fNz; // number of z planes (at least two)
42 Double_t fZcurrent; // current Z position
43 Double_t *fX; //[fNvert] X positions for polygon vertices
44 Double_t *fY; //[fNvert] Y positions for polygon vertices
45 Double_t *fZ; //[fNz] array of Z planes positions
46 Double_t *fScale; //[fNz] array of scale factors (for each Z)
47 Double_t *fX0; //[fNz] array of X offsets (for each Z)
48 Double_t *fY0; //[fNz] array of Y offsets (for each Z)
49
50 mutable std::vector<ThreadData_t *> fThreadData; //! Navigation data per thread
51 mutable Int_t fThreadSize; //! size of thread-specific array
52 mutable std::mutex fMutex; //! mutex for thread data
53
54 TGeoXtru(const TGeoXtru &) = delete;
55 TGeoXtru &operator=(const TGeoXtru &) = delete;
56
57 // methods
59 DistToPlane(const Double_t *point, const Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const;
60 void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const;
61 void GetPlaneNormal(const Double_t *vert, Double_t *norm) const;
62 Bool_t IsPointInsidePlane(const Double_t *point, Double_t *vert, Double_t *norm) const;
63 Double_t SafetyToSector(const Double_t *point, Int_t iz, Double_t safmin, Bool_t in);
64 void SetIz(Int_t iz);
65 void SetSeg(Int_t iseg);
66
67public:
68 // constructors
72 // destructor
73 ~TGeoXtru() override;
74 // methods
75 Double_t Capacity() const override;
76 void ComputeBBox() override;
77 void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override;
78 void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override;
79 Bool_t Contains(const Double_t *point) const override;
80 void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override;
81 Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv);
82 virtual void DefineSection(Int_t snum, Double_t z, Double_t x0 = 0., Double_t y0 = 0., Double_t scale = 1.);
83 Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact = 1, Double_t step = TGeoShape::Big(),
84 Double_t *safe = nullptr) const override;
85 void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
86 Double_t *step) const override;
87 Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact = 1,
88 Double_t step = TGeoShape::Big(), Double_t *safe = nullptr) const override;
89 void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize,
90 Double_t *step) const override;
93 const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override;
94 // virtual Int_t GetByteCount() const {return 60+12*fNz;}
95 Int_t GetNz() const { return fNz; }
96 Int_t GetNvert() const { return fNvert; }
97 Double_t GetX(Int_t i) const { return (i < fNvert && i > -1 && fX) ? fX[i] : -1.0E10; }
98 Double_t GetY(Int_t i) const { return (i < fNvert && i > -1 && fY) ? fY[i] : -1.0E10; }
99 Double_t GetXOffset(Int_t i) const { return (i < fNz && i > -1 && fX0) ? fX0[i] : 0.0; }
100 Double_t GetYOffset(Int_t i) const { return (i < fNz && i > -1 && fY0) ? fY0[i] : 0.0; }
101 Double_t GetScale(Int_t i) const { return (i < fNz && i > -1 && fScale) ? fScale[i] : 1.0; }
102 Double_t *GetZ() const { return fZ; }
103 Double_t GetZ(Int_t ipl) const;
104 TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const override { return nullptr; }
105 void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override;
106 Int_t GetNmeshVertices() const override;
107 void InspectShape() const override;
108 TBuffer3D *MakeBuffer3D() const override;
109 Double_t &Z(Int_t ipl) { return fZ[ipl]; }
110 Double_t Safety(const Double_t *point, Bool_t in = kTRUE) const override;
111 void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override;
112 void SavePrimitive(std::ostream &out, Option_t *option = "") override;
115 void SetDimensions(Double_t *param) override;
116 void SetPoints(Double_t *points) const override;
117 void SetPoints(Float_t *points) const override;
118 void SetSegsAndPols(TBuffer3D &buff) const override;
119 void Sizeof3D() const override;
120
121 ClassDefOverride(TGeoXtru, 3) // extruded polygon class
122};
123
124#endif
float Float_t
Definition RtypesCore.h:57
constexpr Bool_t kTRUE
Definition RtypesCore.h:93
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 points
Generic 3D primitive description class.
Definition TBuffer3D.h:18
Geometrical transformation package.
Definition TGeoMatrix.h:38
An arbitrary polygon defined by vertices.
Definition TGeoPolygon.h:19
Base abstract class for all shapes.
Definition TGeoShape.h:25
static Double_t Big()
Definition TGeoShape.h:87
Double_t * fScale
Definition TGeoXtru.h:46
ThreadData_t & GetThreadData() const
Int_t GetNmeshVertices() const override
Double_t * fX0
Definition TGeoXtru.h:47
virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.)
void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
void ClearThreadData() const override
Double_t Capacity() const override
Int_t fNz
Definition TGeoXtru.h:41
Double_t & Z(Int_t ipl)
Definition TGeoXtru.h:109
Double_t * fZ
Definition TGeoXtru.h:45
void ComputeBBox() override
void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const override
Bool_t Contains(const Double_t *point) const override
Int_t fThreadSize
Navigation data per thread.
Definition TGeoXtru.h:51
TGeoXtru(Double_t *param)
Int_t fNvert
Definition TGeoXtru.h:40
void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale)
TGeoXtru(const TGeoXtru &)=delete
mutex for thread data
void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm) override
void SavePrimitive(std::ostream &out, Option_t *option="") override
Save a primitive as a C++ statement(s) on output stream "out".
void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const
Double_t GetYOffset(Int_t i) const
Definition TGeoXtru.h:100
void InspectShape() const override
Int_t DistancetoPrimitive(Int_t px, Int_t py) override
Computes distance from point (px,py) to the object.
Double_t * GetZ() const
Definition TGeoXtru.h:102
Bool_t IsPointInsidePlane(const Double_t *point, Double_t *vert, Double_t *norm) const
void Sizeof3D() const override
Double_t GetZ(Int_t ipl) const
~TGeoXtru() override
const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const override
Stub implementation to avoid forcing implementation at this stage.
Int_t GetNvert() const
Definition TGeoXtru.h:96
Double_t * fY0
Definition TGeoXtru.h:48
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
void SetCurrentZ(Double_t z, Int_t iz)
Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const override
void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize) override
Double_t GetY(Int_t i) const
Definition TGeoXtru.h:98
void SetDimensions(Double_t *param) override
void DrawPolygon(Option_t *option="")
void SetPoints(Double_t *points) const override
Double_t SafetyToSector(const Double_t *point, Int_t iz, Double_t safmin, Bool_t in)
Double_t * fY
Definition TGeoXtru.h:44
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
void SetPoints(Float_t *points) const override
Double_t * fX
Definition TGeoXtru.h:43
void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const override
TBuffer3D * MakeBuffer3D() const override
std::vector< ThreadData_t * > fThreadData
Definition TGeoXtru.h:50
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const
void SetSegsAndPols(TBuffer3D &buff) const override
Double_t GetScale(Int_t i) const
Definition TGeoXtru.h:101
void SetSeg(Int_t iseg)
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
TGeoShape * GetMakeRuntimeShape(TGeoShape *, TGeoMatrix *) const override
Definition TGeoXtru.h:104
std::mutex fMutex
size of thread-specific array
Definition TGeoXtru.h:52
Double_t GetXOffset(Int_t i) const
Definition TGeoXtru.h:99
void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const override
void GetPlaneNormal(const Double_t *vert, Double_t *norm) const
void SetIz(Int_t iz)
TGeoXtru(Int_t nz)
Int_t GetNz() const
Definition TGeoXtru.h:95
void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const override
TGeoXtru & operator=(const TGeoXtru &)=delete
void CreateThreadData(Int_t nthreads) override
Double_t GetX(Int_t i) const
Definition TGeoXtru.h:97
Double_t fZcurrent
Definition TGeoXtru.h:42
TGeoPolygon * fPoly
Definition TGeoXtru.h:29