Logo ROOT  
Reference Guide
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 
20 class TGeoPolygon;
21 
22 class TGeoXtru : public TGeoBBox
23 {
24 public:
25  struct ThreadData_t
26  {
27  Int_t fSeg; // !current segment [0,fNvert-1]
28  Int_t fIz; // !current z plane [0,fNz-1]
29  Double_t *fXc; // ![fNvert] current X positions for polygon vertices
30  Double_t *fYc; // ![fNvert] current Y positions for polygon vertices
31  TGeoPolygon *fPoly; // !polygon defining section shape
32 
33  ThreadData_t();
34  ~ThreadData_t();
35  };
36  ThreadData_t& GetThreadData() const;
37  virtual void ClearThreadData() const;
38  virtual void CreateThreadData(Int_t nthreads);
39 
40 protected:
41  // data members
42  Int_t fNvert; // number of vertices of the 2D polygon (at least 3)
43  Int_t fNz; // number of z planes (at least two)
44  Double_t fZcurrent; // current Z position
45  Double_t *fX; //[fNvert] X positions for polygon vertices
46  Double_t *fY; //[fNvert] Y positions for polygon vertices
47  Double_t *fZ; //[fNz] array of Z planes positions
48  Double_t *fScale; //[fNz] array of scale factors (for each Z)
49  Double_t *fX0; //[fNz] array of X offsets (for each Z)
50  Double_t *fY0; //[fNz] array of Y offsets (for each Z)
51 
52  mutable std::vector<ThreadData_t*> fThreadData; //! Navigation data per thread
53  mutable Int_t fThreadSize; //! size of thread-specific array
54  mutable std::mutex fMutex; //! mutex for thread data
55 
56  TGeoXtru(const TGeoXtru&) = delete;
57  TGeoXtru& operator=(const TGeoXtru&) = delete;
58 
59  // methods
60  Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const;
61  void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const;
62  void GetPlaneNormal(const Double_t *vert, Double_t *norm) const;
63  Bool_t IsPointInsidePlane(const Double_t *point, Double_t *vert, Double_t *norm) const;
64  Double_t SafetyToSector(const Double_t *point, Int_t iz, Double_t safmin, Bool_t in);
65  void SetIz(Int_t iz);
66  void SetSeg(Int_t iseg);
67 
68 public:
69  // constructors
70  TGeoXtru();
71  TGeoXtru(Int_t nz);
72  TGeoXtru(Double_t *param);
73  // destructor
74  virtual ~TGeoXtru();
75  // methods
76  virtual Double_t Capacity() const;
77  virtual void ComputeBBox();
78  virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm);
79  virtual void ComputeNormal_v(const Double_t *points, const Double_t *dirs, Double_t *norms, Int_t vecsize);
80  virtual Bool_t Contains(const Double_t *point) const;
81  virtual void Contains_v(const Double_t *points, Bool_t *inside, Int_t vecsize) const;
82  Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv);
83  virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.);
84  virtual Double_t DistFromInside(const Double_t *point, const Double_t *dir, Int_t iact=1,
85  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
86  virtual void DistFromInside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
87  virtual Double_t DistFromOutside(const Double_t *point, const Double_t *dir, Int_t iact=1,
88  Double_t step=TGeoShape::Big(), Double_t *safe=0) const;
89  virtual void DistFromOutside_v(const Double_t *points, const Double_t *dirs, Double_t *dists, Int_t vecsize, Double_t *step) const;
90  virtual Int_t DistancetoPrimitive(Int_t px, Int_t py);
91  void DrawPolygon(Option_t *option="");
92  virtual const TBuffer3D &GetBuffer3D(Int_t reqSections, Bool_t localFrame) const;
93 // virtual Int_t GetByteCount() const {return 60+12*fNz;}
94  Int_t GetNz() const {return fNz;}
95  Int_t GetNvert() const {return fNvert;}
96  Double_t GetX(Int_t i) const {return (i<fNvert&&i>-1 &&fX!=0) ? fX[i] : -1.0E10;}
97  Double_t GetY(Int_t i) const {return (i<fNvert&&i>-1 &&fY!=0) ? fY[i] : -1.0E10;}
98  Double_t GetXOffset(Int_t i) const {return (i<fNz&&i>-1 && fX0!=0) ? fX0[i] : 0.0;}
99  Double_t GetYOffset(Int_t i) const {return (i<fNz&&i>-1 && fY0!=0) ? fY0[i] : 0.0;}
100  Double_t GetScale(Int_t i) const {return (i<fNz&&i>-1 && fScale!=0) ? fScale[i] : 1.0;}
101  Double_t *GetZ() const {return fZ;}
102  Double_t GetZ(Int_t ipl) const;
103  virtual TGeoShape *GetMakeRuntimeShape(TGeoShape * /*mother*/, TGeoMatrix * /*mat*/) const {return 0;}
104  virtual void GetMeshNumbers(Int_t &nvert, Int_t &nsegs, Int_t &npols) const;
105  virtual Int_t GetNmeshVertices() const;
106  virtual void InspectShape() const;
107  virtual TBuffer3D *MakeBuffer3D() const;
108  Double_t &Z(Int_t ipl) {return fZ[ipl];}
109  virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const;
110  virtual void Safety_v(const Double_t *points, const Bool_t *inside, Double_t *safe, Int_t vecsize) const;
111  virtual void SavePrimitive(std::ostream &out, Option_t *option = "");
112  void SetCurrentZ(Double_t z, Int_t iz);
113  void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale);
114  virtual void SetDimensions(Double_t *param);
115  virtual void SetPoints(Double_t *points) const;
116  virtual void SetPoints(Float_t *points) const;
117  virtual void SetSegsAndPols(TBuffer3D &buff) const;
118  virtual void Sizeof3D() const;
119 
120  ClassDef(TGeoXtru, 3) // extruded polygon class
121 };
122 
123 #endif
TGeoXtru::GetY
Double_t GetY(Int_t i) const
Definition: TGeoXtru.h:97
TGeoXtru::Capacity
virtual Double_t Capacity() const
Compute capacity [length^3] of this shape.
Definition: TGeoXtru.cxx:247
kTRUE
const Bool_t kTRUE
Definition: RtypesCore.h:91
TGeoXtru::SetIz
void SetIz(Int_t iz)
Set current z-plane.
Definition: TGeoXtru.cxx:141
TGeoXtru::fY0
Double_t * fY0
Definition: TGeoXtru.h:50
TGeoXtru::SavePrimitive
virtual void SavePrimitive(std::ostream &out, Option_t *option="")
Save a primitive as a C++ statement(s) on output stream "out".
Definition: TGeoXtru.cxx:1049
TGeoXtru
Definition: TGeoXtru.h:22
TGeoXtru::ThreadData_t::fPoly
TGeoPolygon * fPoly
Definition: TGeoXtru.h:31
TGeoXtru::SetDimensions
virtual void SetDimensions(Double_t *param)
Definition: TGeoXtru.cxx:1120
TGeoXtru::fMutex
std::mutex fMutex
size of thread-specific array
Definition: TGeoXtru.h:54
TGeoXtru::fNz
Int_t fNz
Definition: TGeoXtru.h:43
Float_t
float Float_t
Definition: RtypesCore.h:57
TGeoXtru::ThreadData_t::~ThreadData_t
~ThreadData_t()
Destructor.
Definition: TGeoXtru.cxx:81
Int_t
int Int_t
Definition: RtypesCore.h:45
TGeoXtru::ComputeNormal
virtual void ComputeNormal(const Double_t *point, const Double_t *dir, Double_t *norm)
Compute normal to closest surface from POINT.
Definition: TGeoXtru.cxx:303
TGeoXtru::Z
Double_t & Z(Int_t ipl)
Definition: TGeoXtru.h:108
TGeoXtru::GetMakeRuntimeShape
virtual TGeoShape * GetMakeRuntimeShape(TGeoShape *, TGeoMatrix *) const
In case shape has some negative parameters, these has to be computed in order to fit the mother.
Definition: TGeoXtru.h:103
TGeoXtru::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: TGeoXtru.cxx:1275
TGeoXtru::fThreadData
std::vector< ThreadData_t * > fThreadData
Definition: TGeoXtru.h:52
TGeoBBox.h
Bool_t
bool Bool_t
Definition: RtypesCore.h:63
TGeoXtru::~TGeoXtru
virtual ~TGeoXtru()
destructor
Definition: TGeoXtru.cxx:233
bool
TGeoXtru::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: TGeoXtru.cxx:1283
TGeoXtru::operator=
TGeoXtru & operator=(const TGeoXtru &)=delete
TGeoXtru::CreateThreadData
virtual void CreateThreadData(Int_t nthreads)
Create thread data for n threads max.
Definition: TGeoXtru.cxx:115
TGeoXtru::DefinePolygon
Bool_t DefinePolygon(Int_t nvert, const Double_t *xv, const Double_t *yv)
Creates the polygon representing the blueprint of any Xtru section.
Definition: TGeoXtru.cxx:657
TGeoXtru::GetPlaneNormal
void GetPlaneNormal(const Double_t *vert, Double_t *norm) const
Returns normal vector to the planar quadrilateral defined by vector VERT.
Definition: TGeoXtru.cxx:726
TGeoXtru::GetScale
Double_t GetScale(Int_t i) const
Definition: TGeoXtru.h:100
TGeoXtru::GetPlaneVertices
void GetPlaneVertices(Int_t iz, Int_t ivert, Double_t *vert) const
Returns (x,y,z) of 3 vertices of the surface defined by Z sections (iz, iz+1) and polygon vertices (i...
Definition: TGeoXtru.cxx:751
TBuffer3D
Definition: TBuffer3D.h:17
Option_t
const typedef char Option_t
Definition: RtypesCore.h:66
TGeoXtru::ThreadData_t::fSeg
Int_t fSeg
Definition: TGeoXtru.h:27
TGeoXtru::Contains
virtual Bool_t Contains(const Double_t *point) const
test if point is inside this shape
Definition: TGeoXtru.cxx:325
TGeoShape
Definition: TGeoShape.h:25
TGeoXtru::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 polycone locate Z segment
Definition: TGeoXtru.cxx:430
TGeoXtru::GetNvert
Int_t GetNvert() const
Definition: TGeoXtru.h:95
TGeoPolygon
Definition: TGeoPolygon.h:19
TGeoXtru::GetNz
Int_t GetNz() const
Definition: TGeoXtru.h:94
TGeoXtru::ThreadData_t::fYc
Double_t * fYc
Definition: TGeoXtru.h:30
TGeoXtru::fZcurrent
Double_t fZcurrent
Definition: TGeoXtru.h:44
TGeoXtru::fScale
Double_t * fScale
Definition: TGeoXtru.h:48
TGeoXtru::fX0
Double_t * fX0
Definition: TGeoXtru.h:49
TGeoXtru::DefineSection
virtual void DefineSection(Int_t snum, Double_t z, Double_t x0=0., Double_t y0=0., Double_t scale=1.)
defines z position of a section plane, rmin and rmax at this z.
Definition: TGeoXtru.cxx:690
TGeoXtru::ThreadData_t::fIz
Int_t fIz
Definition: TGeoXtru.h:28
TGeoBBox
Definition: TGeoBBox.h:17
TGeoXtru::ThreadData_t::fXc
Double_t * fXc
Definition: TGeoXtru.h:29
TGeoXtru::ComputeBBox
virtual void ComputeBBox()
compute bounding box of the pcon
Definition: TGeoXtru.cxx:269
TGeoXtru::fNvert
Int_t fNvert
Definition: TGeoXtru.h:42
TGeoXtru::GetXOffset
Double_t GetXOffset(Int_t i) const
Definition: TGeoXtru.h:98
TGeoXtru::GetNmeshVertices
virtual Int_t GetNmeshVertices() const
Return number of vertices of the mesh representation.
Definition: TGeoXtru.cxx:1214
TGeoXtru::ThreadData_t
Definition: TGeoXtru.h:25
TGeoXtru::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 tube Warning("DistFromOutside",...
Definition: TGeoXtru.cxx:544
TGeoXtru::GetThreadData
ThreadData_t & GetThreadData() const
Definition: TGeoXtru.cxx:90
TGeoXtru::SetCurrentVertices
void SetCurrentVertices(Double_t x0, Double_t y0, Double_t scale)
Set current vertex coordinates according X0, Y0 and SCALE.
Definition: TGeoXtru.cxx:1098
TGeoXtru::Safety
virtual Double_t Safety(const Double_t *point, Bool_t in=kTRUE) const
computes the closest distance from given point to this shape, according to option.
Definition: TGeoXtru.cxx:1004
TGeoXtru::IsPointInsidePlane
Bool_t IsPointInsidePlane(const Double_t *point, Double_t *vert, Double_t *norm) const
Check if the quadrilateral defined by VERT contains a coplanar POINT.
Definition: TGeoXtru.cxx:806
TGeoXtru::SafetyToSector
Double_t SafetyToSector(const Double_t *point, Int_t iz, Double_t safmin, Bool_t in)
Compute safety to sector iz, returning also the closest segment index.
Definition: TGeoXtru.cxx:936
TGeoXtru::GetYOffset
Double_t GetYOffset(Int_t i) const
Definition: TGeoXtru.h:99
TGeoXtru::SetCurrentZ
void SetCurrentZ(Double_t z, Int_t iz)
Recompute current section vertices for a given Z position within range of section iz.
Definition: TGeoXtru.cxx:1076
Double_t
double Double_t
Definition: RtypesCore.h:59
TGeoXtru::GetZ
Double_t * GetZ() const
Definition: TGeoXtru.h:101
TGeoMatrix
Definition: TGeoMatrix.h:40
TGeoXtru::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: TGeoXtru.cxx:1202
TGeoXtru::DistToPlane
Double_t DistToPlane(const Double_t *point, const Double_t *dir, Int_t iz, Int_t ivert, Double_t stepmax, Bool_t in) const
Compute distance to a Xtru lateral surface.
Definition: TGeoXtru.cxx:374
TGeoXtru::MakeBuffer3D
virtual TBuffer3D * MakeBuffer3D() const
Creates a TBuffer3D describing this shape.
Definition: TGeoXtru.cxx:848
points
point * points
Definition: X3DBuffer.c:22
ClassDef
#define ClassDef(name, id)
Definition: Rtypes.h:325
TGeoXtru::fZ
Double_t * fZ
Definition: TGeoXtru.h:47
TGeoXtru::SetSegsAndPols
virtual void SetSegsAndPols(TBuffer3D &buff) const
Fill TBuffer3D structure for segments and polygons.
Definition: TGeoXtru.cxx:870
TGeoXtru::fY
Double_t * fY
Definition: TGeoXtru.h:46
TGeoXtru::GetBuffer3D
virtual const TBuffer3D & GetBuffer3D(Int_t reqSections, Bool_t localFrame) const
Fills a static 3D buffer and returns a reference.
Definition: TGeoXtru.cxx:1230
TGeoXtru::ThreadData_t::ThreadData_t
ThreadData_t()
Constructor.
Definition: TGeoXtru.cxx:73
TGeoXtru::InspectShape
virtual void InspectShape() const
Print actual Xtru parameters.
Definition: TGeoXtru.cxx:831
TGeoXtru::ClearThreadData
virtual void ClearThreadData() const
Definition: TGeoXtru.cxx:99
TGeoXtru::SetPoints
virtual void SetPoints(Double_t *points) const
create polycone mesh points
Definition: TGeoXtru.cxx:1144
TGeoXtru::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: TGeoXtru.cxx:1265
TGeoShape::Big
static Double_t Big()
Definition: TGeoShape.h:88
TGeoXtru::GetX
Double_t GetX(Int_t i) const
Definition: TGeoXtru.h:96
TGeoXtru::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: TGeoXtru.cxx:1301
TGeoXtru::Sizeof3D
virtual void Sizeof3D() const
fill size of this 3-D object
Definition: TGeoXtru.cxx:1223
TGeoXtru::DistancetoPrimitive
virtual Int_t DistancetoPrimitive(Int_t px, Int_t py)
compute closest distance from point px,py to each corner
Definition: TGeoXtru.cxx:356
TGeoXtru::DrawPolygon
void DrawPolygon(Option_t *option="")
Draw the section polygon.
Definition: TGeoXtru.cxx:365
TGeoXtru::fThreadSize
Int_t fThreadSize
Navigation data per thread.
Definition: TGeoXtru.h:53
TGeoXtru::SetSeg
void SetSeg(Int_t iseg)
Set current segment.
Definition: TGeoXtru.cxx:148
TGeoXtru::fX
Double_t * fX
Definition: TGeoXtru.h:45
TGeoXtru::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: TGeoXtru.cxx:1291
int
TGeoXtru::TGeoXtru
TGeoXtru()
dummy ctor
Definition: TGeoXtru.cxx:156