-
Notifications
You must be signed in to change notification settings - Fork 35
/
solids.go
391 lines (354 loc) · 15.5 KB
/
solids.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
// Copyright ©2018 The go-hep Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package gdml
import (
"encoding/xml"
)
type Box struct {
XMLName xml.Name `xml:"box"`
Name string `xml:"name,attr"`
X string `xml:"x,attr"`
Y string `xml:"y,attr"`
Z string `xml:"z,attr"`
LUnit string `xml:"lunit,attr"`
}
type Cone struct {
XMLName xml.Name `xml:"cone"`
Name string `xml:"name,attr"`
RMin1 string `xml:"rmin1,attr"` // inner radius at base of cone
RMax1 string `xml:"rmax1,attr"` // outer radius at base of cone
RMin2 string `xml:"rmin2,attr"` // inner radius at top of cone
RMax2 string `xml:"rmax2,attr"` // outer radius at top of cone
Z string `xml:"z,attr"` // height of cone segment
StartPhi string `xml:"startphi,attr"` // start angle of the segment
DPhi string `xml:"deltaphi,attr"` // angle of the segment
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
}
type Ellipsoid struct {
XMLName xml.Name `xml:"ellipsoid"`
Name string `xml:"name,attr"`
Ax string `xml:"ax,attr"` // x semi axis
By string `xml:"by,attr"` // y semi axis
Cz string `xml:"cz,attr"` // z semi axis
ZCut1 string `xml:"zcut1,attr"`
ZCut2 string `xml:"zcut2,attr"`
LUnit string `xml:"lunit,attr"`
}
type EllipticalTube struct {
XMLName xml.Name `xml:"eltube"`
Name string `xml:"name,attr"`
Dx string `xml:"dx,attr"` // x semi axis
Dy string `xml:"dy,attr"` // y semi axis
Dz string `xml:"dz,attr"` // z semi axis
LUnit string `xml:"lunit,attr"`
}
type EllipticalCone struct {
XMLName xml.Name `xml:"elcone"`
Name string `xml:"name,attr"`
Dx string `xml:"dx,attr"` // x semi axis
Dy string `xml:"dy,attr"` // y semi axis
ZMax string `xml:"zmax,attr"`
ZCut string `xml:"zcut,attr"`
LUnit string `xml:"lunit,attr"`
}
type Orb struct {
XMLName xml.Name `xml:"orb"`
Name string `xml:"name,attr"`
R string `xml:"r,attr"` // radius
LUnit string `xml:"lunit,attr"`
}
type Paraboloid struct {
XMLName xml.Name `xml:"paraboloid"`
Name string `xml:"name,attr"`
Rlo string `xml:"rlo,attr"` // radius at -z
Rhi string `xml:"rhi,attr"` // radius at +z
Dz string `xml:"dz,attr"` // z length
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
}
type Parallelepiped struct {
XMLName xml.Name `xml:"para"`
Name string `xml:"name,attr"`
X string `xml:"x,attr"` // length of x
Y string `xml:"y,attr"` // length of y
Z string `xml:"z,attr"` // length of z
Alpha string `xml:"alpha,attr"` // angle between x and z planes
Theta string `xml:"theta,attr"` // polar angle of the line joining the centres of the faces at -z and +z
Phi string `xml:"phi,attr"` // azimuthal angle of the line joining the centres of the faces at -x and +z
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
}
type PolyCone struct {
XMLName xml.Name `xml:"polycone"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
ZPlanes []ZPlane `xml:"zplane"`
}
type ZPlane struct {
XMLName xml.Name `xml:"zplane"`
RMin string `xml:"rmin,attr"` // inner radius of cone at this point
RMax string `xml:"rmax,attr"` // outer radius of cone at this point
Z string `xml:"z,attr"` // z coordinate of the plane
}
type GenericPolyCone struct {
XMLName xml.Name `xml:"genericPolycone"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
RZPoints []RZPoint `xml:"rzpoint"`
}
type RZPoint struct {
XMLName xml.Name `xml:"rzpoint"`
R string `xml:"r,attr"` // r coordinate of this point
Z string `xml:"z,attr"` // z coordinate of this point
}
type PolyHedra struct {
XMLName xml.Name `xml:"polyhedra"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
NumSides string `xml:"numsides,attr"` // number of sides
ZPlanes []ZPlane `xml:"zplane"`
}
type GenericPolyHedra struct {
XMLName xml.Name `xml:"genericPolyhedra"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
NumSides string `xml:"numsides,attr"` // number of sides
RZPoints []RZPoint `xml:"rzpoint"`
}
type Sphere struct {
XMLName xml.Name `xml:"sphere"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
RMin string `xml:"rmin,attr"` // inner radius
RMax string `xml:"rmax,attr"` // outer radius
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
StartTheta string `xml:"starttheta,attr"` // start angle of the segment - default: 0.0
DTheta string `xml:"deltatheta,attr"` // angle of the segment
}
type Torus struct {
XMLName xml.Name `xml:"torus"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
RMin string `xml:"rmin,attr"` // inner radius of segment
RMax string `xml:"rmax,attr"` // outer radius of segment
Rtor string `xml:"rtor,attr"` // swept radius of torus
StartPhi string `xml:"startphi,attr"` // start angle of the segment - default: 0.0
DPhi string `xml:"deltaphi,attr"` // angle of the segment
}
type Trapezoid struct {
XMLName xml.Name `xml:"trd"`
Name string `xml:"name,attr"`
LUnit string `xml:"lunit,attr"`
X1 string `xml:"x1,attr"` // x length at -z
X2 string `xml:"x2,attr"` // x length at +z
Y1 string `xml:"y1,attr"` // y length at -z
Y2 string `xml:"y2,attr"` // y length at +z
Z string `xml:"z,attr"` // z length
}
type GeneralTrapezoid struct {
XMLName xml.Name `xml:"trap"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
Z string `xml:"z,attr"` // length along z axis
Theta string `xml:"theta,attr"` // polar angle to faces joining at -/+ z
Phi string `xml:"phi,attr"` // azimuthal angle of line joining centre of -z to centre of +z face
Y1 string `xml:"y1,attr"` // length along y at the face -z
X1 string `xml:"x1,attr"` // length along x at side y = -y1 of the face at -z
X2 string `xml:"x2,attr"` // length along x at side y = +y1 of the face at -z
Alpha1 string `xml:"alpha1,attr"` // angle with respect to the y axis from the centre of side at y = -y1 to centre of y = +y1 of the face at -z
Y2 string `xml:"y2,attr"` // length along y at the face +z
X3 string `xml:"x3,attr"` // length along x at side y = -y1 of the face at +z
X4 string `xml:"x4,attr"` // length along x at side y = +y1 of the face at +z
Alpha2 string `xml:"alpha2,attr"` // angle with respect to the y axis from the centre of side at y = -y2 to centre of y = +y2 of the face at +z
}
type HyperbolicTube struct {
XMLName xml.Name `xml:"hype"`
Name string `xml:"name,attr"`
LUnit string `xml:"lunit,attr"`
RMin string `xml:"rmin,attr"` // inside radius of tube
RMax string `xml:"rmax,attr"` // outside radius of tube
InStereo string `xml:"inst,attr"` // inner stereo
OutStereo string `xml:"outst,attr"` // outer stereo
Z string `xml:"z,attr"` // z length
}
type CutTube struct {
XMLName xml.Name `xml:"cutTube"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
Z string `xml:"z,attr"` // z length
RMin string `xml:"rmin,attr"` // inside radius, default:0.0
RMax string `xml:"rmax,attr"` // outside radius
StartPhi string `xml:"startphi,attr"` // starting phi angle of segment, default:0.0
DPhi string `xml:"deltaphi,attr"` // delta phi of angle
LowX string `xml:"lowX,attr"` // normal at lower z plane
LowY string `xml:"lowY,attr"` // normal at lower z plane
LowZ string `xml:"lowZ,attr"` // normal at lower z plane
HighX string `xml:"highX,attr"` // normal at upper z plane
HighY string `xml:"highY,attr"` // normal at upper z plane
HighZ string `xml:"highZ,attr"` // normal at upper z plane
}
type Tube struct {
XMLName xml.Name `xml:"tube"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
Z string `xml:"z,attr"` // z length
RMin string `xml:"rmin,attr"` // inside radius, default:0.0
RMax string `xml:"rmax,attr"` // outside radius
StartPhi string `xml:"startphi,attr"` // starting phi angle of segment, default:0.0
DPhi string `xml:"deltaphi,attr"` // delta phi of angle
}
type TwistedBox struct {
XMLName xml.Name `xml:"twistedbox"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
PhiTwist string `xml:"PhiTwist,attr"`
X string `xml:"x,attr"`
Y string `xml:"y,attr"`
Z string `xml:"z,attr"`
}
type TwistedTrapezoid struct {
XMLName xml.Name `xml:"twistedtrd"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
PhiTwist string `xml:"PhiTwist,attr"`
X1 string `xml:"x1,attr"` // x length at -z
X2 string `xml:"x2,attr"` // x length at +z
Y1 string `xml:"y1,attr"` // y length at -z
Y2 string `xml:"y2,attr"` // y length at +z
Z string `xml:"z,attr"` // z length
}
type TwistedGeneralTrapezoid struct {
XMLName xml.Name `xml:"twistedtrap"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
PhiTwist string `xml:"PhiTwist,attr"`
Z string `xml:"z,attr"` // length along z axis
Theta string `xml:"theta,attr"` // polar angle to faces joining at -/+ z
Phi string `xml:"phi,attr"` // azimuthal angle of line joining centre of -z to centre of +z face
Y1 string `xml:"y1,attr"` // length along y at the face -z
X1 string `xml:"x1,attr"` // length along x at side y = -y1 of the face at -z
X2 string `xml:"x2,attr"` // length along x at side y = +y1 of the face at -z
Y2 string `xml:"y2,attr"` // length along y at the face +z
X3 string `xml:"x3,attr"` // length along x at side y = -y1 of the face at +z
X4 string `xml:"x4,attr"` // length along x at side y = +y1 of the face at +z
Alpha string `xml:"Alph,attr"` // angle with respect to the y axis from the centre of side
}
type TwistedTube struct {
XMLName xml.Name `xml:"twistedtube"`
Name string `xml:"name,attr"`
AUnit string `xml:"aunit,attr"`
LUnit string `xml:"lunit,attr"`
EndInnerRad string `xml:"endinnerrad,attr"` // inside radius at end of segment
EndOuterRad string `xml:"endouterrad,attr"` // outside radius at end of segment
ZLen string `xml:"zlen,attr"` // z length of tube segment
TwistedAngle string `xml:"twistedangle,attr"` // twist angle
Phi string `xml:"phi,attr"` // phi angle of segment
MidInnerRad string `xml:"midinnerrad,attr"` // inner radius at z=0
MidOuterRad string `xml:"midouterrad,attr"` // outer radius at z=0
NSeg string `xml:"nseg,attr"` // number of segments in TotPhi
TotPhi string `xml:"totphi,attr"` // total angle of all segments
}
type Extruded struct {
XMLName xml.Name `xml:"xtru"`
Name string `xml:"name,attr"`
LUnit string `xml:"lunit,attr"`
Vertices []Vertex2D `xml:"twoDimVertex"` // vertices of unbound blueprint polygon
Sections []Section `xml:"section"` // z sections
}
type Vertex2D struct {
XMLName xml.Name `xml:"twoDimVertex"`
X string `xml:"x,attr"`
Y string `xml:"y,attr"`
}
type Section struct {
XMLName xml.Name `xml:"section"`
ZOrder string `xml:"zOrder,attr"` // index of the section
ZPos string `xml:"zPosition,attr"` // distance from the plane z=0
XOff string `xml:"xOffset,attr"` // x offset from centre point of original plane
YOff string `xml:"yOffset,attr"` // y offset from centre point of original plane
Fact string `xml:"scalingFactor,attr"` // proportion to original blueprint
}
type ArbitraryTrapezoid struct {
XMLName xml.Name `xml:"arb8"`
Name string `xml:"name,attr"`
LUnit string `xml:"lunit,attr"`
V1x string `xml:"v1x,attr"` // vertex 1 x position
V1y string `xml:"v1y,attr"` // vertex 1 y position
V2x string `xml:"v2x,attr"` // vertex 2 x position
V2y string `xml:"v2y,attr"` // vertex 2 y position
V3x string `xml:"v3x,attr"` // vertex 3 x position
V3y string `xml:"v3y,attr"` // vertex 3 y position
V4x string `xml:"v4x,attr"` // vertex 4 x position
V4y string `xml:"v4y,attr"` // vertex 4 y position
V5x string `xml:"v5x,attr"` // vertex 5 x position
V5y string `xml:"v5y,attr"` // vertex 5 y position
V6x string `xml:"v6x,attr"` // vertex 6 x position
V6y string `xml:"v6y,attr"` // vertex 6 y position
V7x string `xml:"v7x,attr"` // vertex 7 x position
V7y string `xml:"v7y,attr"` // vertex 7 y position
V8x string `xml:"v8x,attr"` // vertex 8 x position
V8y string `xml:"v8y,attr"` // vertex 8 y position
Dz string `xml:"dz,attr"` // half z length
}
type Tesselated struct {
XMLName xml.Name `xml:"tesselated"`
Name string `xml:"name,attr"`
Tris []Triangular `xml:"triangular"`
Quads []Quadrangular `xml:"quadrangular"`
}
type Triangular struct {
XMLName xml.Name `xml:"triangular"`
Vtx1 string `xml:"vertex1,attr"`
Vtx2 string `xml:"vertex2,attr"`
Vtx3 string `xml:"vertex3,attr"`
Type string `xml:"type,attr"` // vertex type: ABSOLUTE (default) or RELATIVE
}
type Quadrangular struct {
XMLName xml.Name `xml:"quadrangular"`
Vtx1 string `xml:"vertex1,attr"`
Vtx2 string `xml:"vertex2,attr"`
Vtx3 string `xml:"vertex3,attr"`
Vtx4 string `xml:"vertex4,attr"`
Type string `xml:"type,attr"` // vertex type: ABSOLUTE (default) or RELATIVE
}
type TetraHedron struct {
XMLName xml.Name `xml:"tet"`
Name string `xml:"name,attr"`
Vtx1 string `xml:"vertex1,attr"`
Vtx2 string `xml:"vertex2,attr"`
Vtx3 string `xml:"vertex3,attr"`
Vtx4 string `xml:"vertex4,attr"`
}
type ScaledSolid struct {
XMLName xml.Name `xml:"scaledSolid"`
Name string `xml:"name,attr"`
Ref SolidRef `xml:"solidref"`
Scale Scale `xml:"scale"`
}
type SolidRef struct {
XMLName xml.Name `xml:"solidref"`
Ref string `xml:"ref,attr"`
}