Go to the documentation of this file.
4 #ifndef tools_hep_polyhedron
5 #define tools_hep_polyhedron
9 #include "../lina/vec3d"
10 #include "../lina/rotd"
14 #include "../S_STRING"
24 #ifdef TOOLS_HEP_PH_OUT_ERR
28 #ifdef TOOLS_HEP_PH_OUT_ERR_TRD2
59 typedef struct {
int v,f; } edge_t;
63 SbFacet(
int v1=0,
int f1=0,
int v2=0,
int f2=0,
64 int v3=0,
int f3=0,
int v4=0,
int f4=0)
67 mem::increment(s_class().c_str());
69 edge[0].v=v1; edge[0].f=f1; edge[1].v=v2; edge[1].f=f2;
70 edge[2].v=v3; edge[2].f=f3; edge[3].v=v4; edge[3].f=f4; }
74 mem::decrement(s_class().c_str());
81 mem::increment(s_class().c_str());
83 edge[0].v = aFrom.edge[0].v;
84 edge[0].f = aFrom.edge[0].f;
85 edge[1].v = aFrom.edge[1].v;
86 edge[1].f = aFrom.edge[1].f;
87 edge[2].v = aFrom.edge[2].v;
88 edge[2].f = aFrom.edge[2].f;
89 edge[3].v = aFrom.edge[3].v;
90 edge[3].f = aFrom.edge[3].f;
93 edge[0].v = aFrom.edge[0].v;
94 edge[0].f = aFrom.edge[0].f;
95 edge[1].v = aFrom.edge[1].v;
96 edge[1].f = aFrom.edge[1].f;
97 edge[2].v = aFrom.edge[2].v;
98 edge[2].f = aFrom.edge[2].f;
99 edge[3].v = aFrom.edge[3].v;
100 edge[3].f = aFrom.edge[3].f;
105 if(edge[0].v!=aFrom.edge[0].v)
return false;
106 if(edge[0].f!=aFrom.edge[0].f)
return false;
108 if(edge[1].v!=aFrom.edge[1].v)
return false;
109 if(edge[1].f!=aFrom.edge[1].f)
return false;
111 if(edge[2].v!=aFrom.edge[2].v)
return false;
112 if(edge[2].f!=aFrom.edge[2].f)
return false;
114 if(edge[3].v!=aFrom.edge[3].v)
return false;
115 if(edge[3].f!=aFrom.edge[3].f)
return false;
124 void set(
int v1,
int f1,
int v2,
int f2,
125 int v3,
int f3,
int v4,
int f4) {
126 edge[0].v=v1; edge[0].f=f1; edge[1].v=v2; edge[1].f=f2;
127 edge[2].v=v3; edge[2].f=f3; edge[3].v=v4; edge[3].f=f4;
132 { edge[0].v = v[0]; edge[0].f = v[1];
133 edge[1].v = v[2]; edge[1].f = v[3];
134 edge[2].v = v[4]; edge[2].f = v[5];
135 edge[3].v = v[6]; edge[3].f = v[7]; }
161 int fNumberOfRotationSteps;
164 static double _M_PI() {
return 3.1415926535897931160E0;}
181 int v1,
int v2,
int vEdge,
182 bool ifWholeCircle,
int ns,
int &kface);
187 double dphi,
int ns,
int &kface);
192 const double *z,
double *r,
193 int nodeVis,
int edgeVis);
213 mem::increment(s_class().c_str());
219 delete []
pV;
delete []
pF;
221 mem::decrement(s_class().c_str());
243 {
delete []
pV;
delete []
pF;
281 int & iface1,
int & iface2)
const;
291 int &iface1,
int &iface2)
const;
295 int *edgeFlags = 0,
int *iFaces = 0)
const;
299 int *edgeFlags = 0,
HVNormal3D *normals = 0)
const;
303 int *edgeFlags=0,
HVNormal3D *normals=0)
const;
330 void dump(std::ostream&)
const;
344 double Rmn2,
double Rmx2,
double Dz,
345 double Phi1,
double Dphi,
352 double vxy(
const double* xy,
int i,
int j) {
return xy[i*2+j];}
356 double Dy1,
double Dy2,
double Dz);
361 double Dy,
double Dz){
366 double Dx1,
double Dx2,
double Alp1,
368 double Dx3,
double Dx4,
double Alp2);
371 double Alpha,
double Theta,
373 return set_polyhedron_trap(Dz,Theta,Phi,Dy,Dx,Dx,Alpha,Dy,Dx,Dx,Alpha);
383 const double *rmax) {
389 double Phi1,
double Dphi,
395 double Rmn2,
double Rmx2,
402 double phi,
double dphi,
407 double* a_xs,
double* a_ys,
double* a_zs,
412 double phi,
double dphi,
413 double the,
double dthe,
418 double a_rmin,
double a_rmax,
double a_dz,
419 int a_nz = 10,
int a_nphi = 24);
421 int a_nz = 10,
int a_nphi = 24);
423 int _ixy(
int,
int,
int,
int,
bool,
bool);
433 bool CHECK_INDEX(
const char* a_method,
int a_index)
const;
442 return a < 0 ? -a : a;
456 static int iFace = 1;
457 static int iQVertex = 0;
459 SbFacet::edge_t* edge = pF[iFace].edge;
460 int vIndex = edge[iQVertex].v;
462 edgeFlag = (vIndex > 0) ? 1 : 0;
466 #ifdef TOOLS_HEP_PH_OUT_ERR
467 std::cerr <<
"polyhedron::GetNextVertexIndex: pV index problem "
468 << index <<
" exceed " << nvert << std::endl;
474 if (iQVertex >= 3 || edge[iQVertex+1].v == 0) {
476 if (++iFace > nface) iFace = 1;
487 double Dy1,
double Dy2,
double Dz);
519 double* a_xs,
double* a_ys,
double* a_zs,
534 double a_rmin,
double a_rmax,
double a_dz,
535 int a_nz = 10,
int a_nphi = 24);
548 double Dy,
double Dz);
580 double Dx1,
double Dx2,
double Alp1,
582 double Dx3,
double Dx4,
double Alp2);
598 double Alpha,
double Theta,
double Phi);
614 double Rmn2,
double Rmx2,
double Dz,
615 double Phi1,
double Dphi,
632 double Rmn2,
double Rmx2,
double Dz,
649 double Phi1,
double Dphi,
717 double phi,
double dphi,
718 double the,
double dthe,
736 double phi,
double dphi,
763 typedef std::pair<Operation,polyhedron> op_t;
767 mem::increment(s_class().c_str());
772 mem::decrement(s_class().c_str());
778 mem::increment(s_class().c_str());
784 m_ops.push_back(op_t(a_op,a_polyhedron));
789 if(!m_ops.size())
return true;
791 std::vector<op_t>::const_iterator it;
792 for(it=m_ops.begin();it!=m_ops.end();++it) {
793 if((*it).first!=op)
return false;
801 std::vector<op_t> m_ops;
817 template <
class MATRIX>
819 typedef typename MATRIX::elem_t T;
824 for (
int i=1; i<=nvert; i++) {
829 a_matrix.mul_3(x,y,z);
#define TOOLS_SCLASS(a_name)