12 #ifndef ROOT_TGeoBoolNode
13 #define ROOT_TGeoBoolNode
24 class TGeoBoolNode :
public TObject
39 ThreadData_t& GetThreadData()
const;
40 void ClearThreadData()
const;
41 void CreateThreadData(Int_t nthreads);
43 TGeoBoolNode(
const TGeoBoolNode&);
44 TGeoBoolNode& operator=(
const TGeoBoolNode&);
50 TGeoMatrix *fRightMat;
54 mutable std::vector<ThreadData_t*> fThreadData;
55 mutable Int_t fThreadSize;
56 mutable std::mutex fMutex;
58 Bool_t MakeBranch(
const char *expr, Bool_t left);
62 TGeoBoolNode(
const char *expr1,
const char *expr2);
63 TGeoBoolNode(TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=0, TGeoMatrix *rmat=0);
66 virtual ~TGeoBoolNode();
68 virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin) = 0;
69 virtual void ComputeNormal(
const Double_t *point,
const Double_t *dir, Double_t *norm) = 0;
70 virtual Bool_t Contains(
const Double_t *point)
const = 0;
71 virtual Int_t DistanceToPrimitive(Int_t px, Int_t py) = 0;
72 virtual Double_t DistFromInside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
73 Double_t step=0, Double_t *safe=0)
const = 0;
74 virtual Double_t DistFromOutside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
75 Double_t step=0, Double_t *safe=0)
const = 0;
76 virtual EGeoBoolType GetBooleanOperator()
const = 0;
77 virtual Int_t GetNpoints() = 0;
78 TGeoMatrix *GetLeftMatrix()
const {
return fLeftMat;}
79 TGeoMatrix *GetRightMatrix()
const {
return fRightMat;}
80 TGeoShape *GetLeftShape()
const {
return fLeft;}
81 TGeoShape *GetRightShape()
const {
return fRight;}
82 virtual TGeoBoolNode *MakeClone()
const = 0;
83 virtual void Paint(Option_t *option);
84 void RegisterMatrices();
85 Bool_t ReplaceMatrix(TGeoMatrix *mat, TGeoMatrix *newmat);
86 virtual Double_t Safety(
const Double_t *point, Bool_t in=kTRUE)
const = 0;
87 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
88 virtual void SetPoints(Double_t *points)
const;
89 virtual void SetPoints(Float_t *points)
const;
90 void SetSelected(Int_t sel);
91 virtual void Sizeof3D()
const;
93 ClassDef(TGeoBoolNode, 1)
102 class TGeoUnion :
public TGeoBoolNode
107 TGeoUnion(
const char *expr1,
const char *expr2);
108 TGeoUnion(TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=0, TGeoMatrix *rmat=0);
111 virtual ~TGeoUnion();
113 virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin);
114 virtual void ComputeNormal(
const Double_t *point,
const Double_t *dir, Double_t *norm);
115 virtual Bool_t Contains(
const Double_t *point)
const;
116 virtual Int_t DistanceToPrimitive(Int_t px, Int_t py);
117 virtual Double_t DistFromInside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
118 Double_t step=0, Double_t *safe=0)
const;
119 virtual Double_t DistFromOutside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
120 Double_t step=0, Double_t *safe=0)
const;
121 virtual EGeoBoolType GetBooleanOperator()
const {
return kGeoUnion;}
122 virtual Int_t GetNpoints();
123 virtual Double_t Safety(
const Double_t *point, Bool_t in=kTRUE)
const;
124 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
125 virtual void Sizeof3D()
const;
128 virtual TGeoBoolNode *MakeClone()
const;
129 virtual void Paint(Option_t *option);
131 ClassDef(TGeoUnion, 1)
141 class TGeoIntersection :
public TGeoBoolNode
146 TGeoIntersection(
const char *expr1,
const char *expr2);
147 TGeoIntersection(TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=0, TGeoMatrix *rmat=0);
150 virtual ~TGeoIntersection();
152 virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin);
153 virtual void ComputeNormal(
const Double_t *point,
const Double_t *dir, Double_t *norm);
154 virtual Bool_t Contains(
const Double_t *point)
const;
155 virtual Int_t DistanceToPrimitive(Int_t px, Int_t py);
156 virtual Double_t DistFromInside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
157 Double_t step=0, Double_t *safe=0)
const;
158 virtual Double_t DistFromOutside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
159 Double_t step=0, Double_t *safe=0)
const;
160 virtual EGeoBoolType GetBooleanOperator()
const {
return kGeoIntersection;}
161 virtual Int_t GetNpoints();
162 virtual Double_t Safety(
const Double_t *point, Bool_t in=kTRUE)
const;
163 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
164 virtual void Sizeof3D()
const;
167 virtual TGeoBoolNode *MakeClone()
const;
168 virtual void Paint(Option_t *option);
170 ClassDef(TGeoIntersection, 1)
179 class TGeoSubtraction :
public TGeoBoolNode
184 TGeoSubtraction(
const char *expr1,
const char *expr2);
185 TGeoSubtraction(TGeoShape *left, TGeoShape *right, TGeoMatrix *lmat=0, TGeoMatrix *rmat=0);
188 virtual ~TGeoSubtraction();
190 virtual void ComputeBBox(Double_t &dx, Double_t &dy, Double_t &dz, Double_t *origin);
191 virtual void ComputeNormal(
const Double_t *point,
const Double_t *dir, Double_t *norm);
192 virtual Bool_t Contains(
const Double_t *point)
const;
193 virtual Int_t DistanceToPrimitive(Int_t px, Int_t py);
194 virtual Double_t DistFromInside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
195 Double_t step=0, Double_t *safe=0)
const;
196 virtual Double_t DistFromOutside(
const Double_t *point,
const Double_t *dir, Int_t iact=1,
197 Double_t step=0, Double_t *safe=0)
const;
198 virtual EGeoBoolType GetBooleanOperator()
const {
return kGeoSubtraction;}
199 virtual Int_t GetNpoints();
200 virtual Double_t Safety(
const Double_t *point, Bool_t in=kTRUE)
const;
201 virtual void SavePrimitive(std::ostream &out, Option_t *option =
"");
202 virtual void Sizeof3D()
const;
205 virtual TGeoBoolNode *MakeClone()
const;
206 virtual void Paint(Option_t *option);
208 ClassDef(TGeoSubtraction, 1)