g4tools  5.4.0
Public Member Functions | Static Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Friends | List of all members
tools::hep::polyhedron Class Reference
Inheritance diagram for tools::hep::polyhedron:
Inheritance graph
[legend]
Collaboration diagram for tools::hep::polyhedron:
Collaboration graph
[legend]

Public Member Functions

 polyhedron (int Nvert=0, int Nface=0)
 
virtual ~polyhedron ()
 
 polyhedron (const polyhedron &from)
 
polyhedronoperator= (const polyhedron &from)
 
void Set (int Nvert, HVPoint3D *aV, int Nface, SbFacet *aF)
 
void Empty ()
 
int GetNoVertices () const
 
int GetNoFacets () const
 
polyhedronTranslate (double, double, double)
 
polyhedronTransform (const rotd &rot, double, double, double)
 
polyhedronTransform (const rotd &rot, const vec3d &trans)
 
bool GetNextVertexIndex (int &index, int &edgeFlag) const
 
HVPoint3D GetVertex (int index) const
 
const HVPoint3DGetVertexFast (int index) const
 
HVPoint3DGetPV () const
 
SbFacetGetPF () const
 
bool GetNextVertex (HVPoint3D &vertex, int &edgeFlag) const
 
bool GetNextVertex (HVPoint3D &vertex, int &edgeFlag, HVNormal3D &normal) const
 
bool GetNextEdgeIndeces (int &i1, int &i2, int &edgeFlag, int &iface1, int &iface2) const
 
bool GetNextEdgeIndeces (int &i1, int &i2, int &edgeFlag) const
 
bool GetNextEdge (HVPoint3D &p1, HVPoint3D &p2, int &edgeFlag) const
 
bool GetNextEdge (HVPoint3D &p1, HVPoint3D &p2, int &edgeFlag, int &iface1, int &iface2) const
 
void GetFacet (int iFace, int &n, int *iNodes, int *edgeFlags=0, int *iFaces=0) const
 
void GetFacet (int iFace, int &n, HVPoint3D *nodes, int *edgeFlags=0, HVNormal3D *normals=0) const
 
bool GetNextFacet (int &n, HVPoint3D *nodes, int *edgeFlags=0, HVNormal3D *normals=0) const
 
HVNormal3D GetNormal (int iFace) const
 
HVNormal3D GetUnitNormal (int iFace) const
 
bool GetNextNormal (HVNormal3D &normal) const
 
bool GetNextUnitNormal (HVNormal3D &normal) const
 
polyhedron add (const polyhedron &p) const
 
polyhedron subtract (const polyhedron &p) const
 
polyhedron intersect (const polyhedron &p) const
 
double GetSurfaceArea () const
 
double GetVolume () const
 
bool isEqual (const polyhedron &p) const
 
bool isConsistent (const char *=0) const
 
void dump (std::ostream &) const
 
int GetNumberOfRotationSteps ()
 
void SetNumberOfRotationSteps (int n)
 
void ResetNumberOfRotationSteps ()
 
bool set_polyhedron_cons (double Rmn1, double Rmx1, double Rmn2, double Rmx2, double Dz, double Phi1, double Dphi, int nstep=0)
 
bool set_polyhedron_tube (double Rmin, double Rmax, double Dz, int nstep=0)
 
double vxy (const double *xy, int i, int j)
 
bool set_polyhedron_arb8 (double Dz, const double *xy)
 
bool set_polyhedron_trd2 (double Dx1, double Dx2, double Dy1, double Dy2, double Dz)
 
bool set_polyhedron_box (double Dx, double Dy, double Dz)
 
bool set_polyhedron_trd1 (double Dx1, double Dx2, double Dy, double Dz)
 
bool set_polyhedron_trap (double Dz, double Theta, double Phi, double Dy1, double Dx1, double Dx2, double Alp1, double Dy2, double Dx3, double Dx4, double Alp2)
 
bool set_polyhedron_para (double Dx, double Dy, double Dz, double Alpha, double Theta, double Phi)
 
bool set_polyhedron_pgon (double phi, double dphi, int npdv, int nz, const double *z, const double *rmin, const double *rmax)
 
bool set_polyhedron_pcon (double phi, double dphi, int nz, const double *z, const double *rmin, const double *rmax)
 
bool set_polyhedron_tubs (double Rmin, double Rmax, double Dz, double Phi1, double Dphi, int nstep)
 
bool set_polyhedron_cone (double Rmn1, double Rmx1, double Rmn2, double Rmx2, double Dz, int nstep)
 
bool set_polyhedron_torus (double rmin, double rmax, double rtor, double phi, double dphi, int nphi, int nthe)
 
bool set_polyhedron_xtru (int a_npts, int a_nz, double *a_xs, double *a_ys, double *a_zs, bool a_acw=true, bool a_zfb=true)
 
bool set_polyhedron_sphere (double rmin, double rmax, double phi, double dphi, double the, double dthe, int nphi=0, int nthe=0)
 
bool set_polyhedron_hype (double a_st_in, double a_st_out, double a_rmin, double a_rmax, double a_dz, int a_nz=10, int a_nphi=24)
 
bool set_polyhedron_eltu (double a_dx, double a_dy, double a_dz, int a_nz=10, int a_nphi=24)
 

Static Public Member Functions

static int NUMBER_OF_STEPS ()
 
static void do_not_set_NUMBER_OF_STEPS (int)
 

Protected Member Functions

void AllocateMemory (int Nvert, int Nface)
 
int FindNeighbour (int iFace, int iNode, int iOrder) const
 
HVNormal3D FindNodeNormal (int iFace, int iNode) const
 
void CreatePrism ()
 
void RotateEdge (int k1, int k2, double r1, double r2, int v1, int v2, int vEdge, bool ifWholeCircle, int ns, int &kface)
 
void SetSideFacets (int ii[4], int vv[4], int *kk, double *r, double dphi, int ns, int &kface)
 
void RotateAroundZ (int nstep, double phi, double dphi, int np1, int np2, const double *z, double *r, int nodeVis, int edgeVis)
 
void SetReferences ()
 
void InvertFacets ()
 

Static Protected Member Functions

static double _M_PI ()
 

Protected Attributes

int nvert
 
int nface
 
HVPoint3DpV
 
SbFacetpF
 

Friends

std::ostream & operator<< (std::ostream &, const polyhedron &ph)
 
int operator== (const polyhedron &v1, const polyhedron &v2)
 
int operator!= (const polyhedron &v1, const polyhedron &v2)
 

Detailed Description

Definition at line 142 of file polyhedron.

Constructor & Destructor Documentation

◆ polyhedron() [1/2]

tools::hep::polyhedron::polyhedron ( int  Nvert = 0,
int  Nface = 0 
)
inline

Definition at line 205 of file polyhedron.

206  : /*m_name(0) //G.Barrand
207  ,*/nvert(Nvert),nface(Nface)
208  ,pV(Nvert ? new HVPoint3D[Nvert+1] : 0)
209  ,pF(Nface ? new SbFacet[Nface+1] : 0)
210  ,fNumberOfRotationSteps(NUMBER_OF_STEPS())
211  {
212 #ifdef TOOLS_MEM
213  mem::increment(s_class().c_str());
214 #endif
215  }

◆ ~polyhedron()

virtual tools::hep::polyhedron::~polyhedron ( )
inlinevirtual

Definition at line 217 of file polyhedron.

217  {
218  //delete m_name; //G.Barrand.
219  delete [] pV; delete [] pF;
220 #ifdef TOOLS_MEM
221  mem::decrement(s_class().c_str());
222 #endif
223  }

◆ polyhedron() [2/2]

tools::hep::polyhedron::polyhedron ( const polyhedron from)

Member Function Documentation

◆ _M_PI()

static double tools::hep::polyhedron::_M_PI ( )
inlinestaticprotected

Definition at line 164 of file polyhedron.

164 {return 3.1415926535897931160E0;}

◆ add()

polyhedron tools::hep::polyhedron::add ( const polyhedron p) const

◆ AllocateMemory()

void tools::hep::polyhedron::AllocateMemory ( int  Nvert,
int  Nface 
)
protected

◆ CreatePrism()

void tools::hep::polyhedron::CreatePrism ( )
protected

◆ do_not_set_NUMBER_OF_STEPS()

static void tools::hep::polyhedron::do_not_set_NUMBER_OF_STEPS ( int  )
inlinestatic

Definition at line 203 of file polyhedron.

203 {}

◆ dump()

void tools::hep::polyhedron::dump ( std::ostream &  ) const

◆ Empty()

void tools::hep::polyhedron::Empty ( )
inline

Definition at line 246 of file polyhedron.

247  { nvert = 0; nface = 0; pV = 0;pF = 0;}

◆ FindNeighbour()

int tools::hep::polyhedron::FindNeighbour ( int  iFace,
int  iNode,
int  iOrder 
) const
protected

◆ FindNodeNormal()

HVNormal3D tools::hep::polyhedron::FindNodeNormal ( int  iFace,
int  iNode 
) const
protected

◆ GetFacet() [1/2]

void tools::hep::polyhedron::GetFacet ( int  iFace,
int &  n,
HVPoint3D nodes,
int *  edgeFlags = 0,
HVNormal3D normals = 0 
) const

◆ GetFacet() [2/2]

void tools::hep::polyhedron::GetFacet ( int  iFace,
int &  n,
int *  iNodes,
int *  edgeFlags = 0,
int *  iFaces = 0 
) const

◆ GetNextEdge() [1/2]

bool tools::hep::polyhedron::GetNextEdge ( HVPoint3D p1,
HVPoint3D p2,
int &  edgeFlag 
) const

◆ GetNextEdge() [2/2]

bool tools::hep::polyhedron::GetNextEdge ( HVPoint3D p1,
HVPoint3D p2,
int &  edgeFlag,
int &  iface1,
int &  iface2 
) const

◆ GetNextEdgeIndeces() [1/2]

bool tools::hep::polyhedron::GetNextEdgeIndeces ( int &  i1,
int &  i2,
int &  edgeFlag 
) const

◆ GetNextEdgeIndeces() [2/2]

bool tools::hep::polyhedron::GetNextEdgeIndeces ( int &  i1,
int &  i2,
int &  edgeFlag,
int &  iface1,
int &  iface2 
) const

◆ GetNextFacet()

bool tools::hep::polyhedron::GetNextFacet ( int &  n,
HVPoint3D nodes,
int *  edgeFlags = 0,
HVNormal3D normals = 0 
) const

◆ GetNextNormal()

bool tools::hep::polyhedron::GetNextNormal ( HVNormal3D normal) const

◆ GetNextUnitNormal()

bool tools::hep::polyhedron::GetNextUnitNormal ( HVNormal3D normal) const

◆ GetNextVertex() [1/2]

bool tools::hep::polyhedron::GetNextVertex ( HVPoint3D vertex,
int &  edgeFlag 
) const

◆ GetNextVertex() [2/2]

bool tools::hep::polyhedron::GetNextVertex ( HVPoint3D vertex,
int &  edgeFlag,
HVNormal3D normal 
) const

◆ GetNextVertexIndex()

bool tools::hep::polyhedron::GetNextVertexIndex ( int &  index,
int &  edgeFlag 
) const
inline

Definition at line 446 of file polyhedron.

455 {
456  static int iFace = 1;
457  static int iQVertex = 0;
458  //G.Barrand : int vIndex = pF[iFace].edge[iQVertex].v;
459  SbFacet::edge_t* edge = pF[iFace].edge; //G.Barrand : optimize.
460  int vIndex = edge[iQVertex].v;
461 
462  edgeFlag = (vIndex > 0) ? 1 : 0;
463  index = Sb_iabs(vIndex);
464 
465  if(index>nvert) {
466 #ifdef TOOLS_HEP_PH_OUT_ERR
467  std::cerr << "polyhedron::GetNextVertexIndex: pV index problem "
468  << index << " exceed " << nvert << std::endl;
469 #endif
470  index = 0;
471  }
472 
473  //G.Barrand : if (iQVertex >= 3 || pF[iFace].edge[iQVertex+1].v == 0) {
474  if (iQVertex >= 3 || edge[iQVertex+1].v == 0) {
475  iQVertex = 0;
476  if (++iFace > nface) iFace = 1;
477  return false; // Last Edge
478  }else{
479  ++iQVertex;
480  return true; // not Last Edge
481  }
482 }

◆ GetNoFacets()

int tools::hep::polyhedron::GetNoFacets ( ) const
inline

Definition at line 253 of file polyhedron.

253 { return nface; }

◆ GetNormal()

HVNormal3D tools::hep::polyhedron::GetNormal ( int  iFace) const

◆ GetNoVertices()

int tools::hep::polyhedron::GetNoVertices ( ) const
inline

Definition at line 250 of file polyhedron.

250 { return nvert; }

◆ GetNumberOfRotationSteps()

int tools::hep::polyhedron::GetNumberOfRotationSteps ( )

◆ GetPF()

SbFacet* tools::hep::polyhedron::GetPF ( ) const
inline

Definition at line 270 of file polyhedron.

270 {return pF;} //G.Barrand

◆ GetPV()

HVPoint3D* tools::hep::polyhedron::GetPV ( ) const
inline

Definition at line 269 of file polyhedron.

269 {return pV;} //G.Barrand

◆ GetSurfaceArea()

double tools::hep::polyhedron::GetSurfaceArea ( ) const

◆ GetUnitNormal()

HVNormal3D tools::hep::polyhedron::GetUnitNormal ( int  iFace) const

◆ GetVertex()

HVPoint3D tools::hep::polyhedron::GetVertex ( int  index) const

◆ GetVertexFast()

const HVPoint3D& tools::hep::polyhedron::GetVertexFast ( int  index) const

◆ GetVolume()

double tools::hep::polyhedron::GetVolume ( ) const

◆ intersect()

polyhedron tools::hep::polyhedron::intersect ( const polyhedron p) const

◆ InvertFacets()

void tools::hep::polyhedron::InvertFacets ( )
protected

◆ isConsistent()

bool tools::hep::polyhedron::isConsistent ( const char *  = 0) const

◆ isEqual()

bool tools::hep::polyhedron::isEqual ( const polyhedron p) const

◆ NUMBER_OF_STEPS()

static int tools::hep::polyhedron::NUMBER_OF_STEPS ( )
inlinestatic

Definition at line 201 of file polyhedron.

201 {return 24;}

◆ operator=()

polyhedron& tools::hep::polyhedron::operator= ( const polyhedron from)

◆ ResetNumberOfRotationSteps()

void tools::hep::polyhedron::ResetNumberOfRotationSteps ( )

◆ RotateAroundZ()

void tools::hep::polyhedron::RotateAroundZ ( int  nstep,
double  phi,
double  dphi,
int  np1,
int  np2,
const double *  z,
double *  r,
int  nodeVis,
int  edgeVis 
)
protected

◆ RotateEdge()

void tools::hep::polyhedron::RotateEdge ( int  k1,
int  k2,
double  r1,
double  r2,
int  v1,
int  v2,
int  vEdge,
bool  ifWholeCircle,
int  ns,
int &  kface 
)
protected

◆ Set()

void tools::hep::polyhedron::Set ( int  Nvert,
HVPoint3D aV,
int  Nface,
SbFacet aF 
)
inline

Definition at line 241 of file polyhedron.

243  { delete [] pV; delete [] pF;
244  nvert = Nvert; nface = Nface; pV = aV; pF = aF;}

◆ set_polyhedron_arb8()

bool tools::hep::polyhedron::set_polyhedron_arb8 ( double  Dz,
const double *  xy 
)

◆ set_polyhedron_box()

bool tools::hep::polyhedron::set_polyhedron_box ( double  Dx,
double  Dy,
double  Dz 
)
inline

Definition at line 357 of file polyhedron.

357  {
358  return set_polyhedron_trd2(Dx, Dx, Dy, Dy, Dz);
359  }

◆ set_polyhedron_cone()

bool tools::hep::polyhedron::set_polyhedron_cone ( double  Rmn1,
double  Rmx1,
double  Rmn2,
double  Rmx2,
double  Dz,
int  nstep 
)
inline

Definition at line 394 of file polyhedron.

397  {
398  return set_polyhedron_cons(Rmn1, Rmx1, Rmn2, Rmx2, Dz, 0, 2*_M_PI(), nstep);
399  }

◆ set_polyhedron_cons()

bool tools::hep::polyhedron::set_polyhedron_cons ( double  Rmn1,
double  Rmx1,
double  Rmn2,
double  Rmx2,
double  Dz,
double  Phi1,
double  Dphi,
int  nstep = 0 
)

◆ set_polyhedron_eltu()

bool tools::hep::polyhedron::set_polyhedron_eltu ( double  a_dx,
double  a_dy,
double  a_dz,
int  a_nz = 10,
int  a_nphi = 24 
)

◆ set_polyhedron_hype()

bool tools::hep::polyhedron::set_polyhedron_hype ( double  a_st_in,
double  a_st_out,
double  a_rmin,
double  a_rmax,
double  a_dz,
int  a_nz = 10,
int  a_nphi = 24 
)

◆ set_polyhedron_para()

bool tools::hep::polyhedron::set_polyhedron_para ( double  Dx,
double  Dy,
double  Dz,
double  Alpha,
double  Theta,
double  Phi 
)
inline

Definition at line 370 of file polyhedron.

372  {
373  return set_polyhedron_trap(Dz,Theta,Phi,Dy,Dx,Dx,Alpha,Dy,Dx,Dx,Alpha);
374  }

◆ set_polyhedron_pcon()

bool tools::hep::polyhedron::set_polyhedron_pcon ( double  phi,
double  dphi,
int  nz,
const double *  z,
const double *  rmin,
const double *  rmax 
)
inline

Definition at line 380 of file polyhedron.

383  {
384  return set_polyhedron_pgon(phi, dphi, 0, nz, z, rmin, rmax);
385  }

◆ set_polyhedron_pgon()

bool tools::hep::polyhedron::set_polyhedron_pgon ( double  phi,
double  dphi,
int  npdv,
int  nz,
const double *  z,
const double *  rmin,
const double *  rmax 
)

◆ set_polyhedron_sphere()

bool tools::hep::polyhedron::set_polyhedron_sphere ( double  rmin,
double  rmax,
double  phi,
double  dphi,
double  the,
double  dthe,
int  nphi = 0,
int  nthe = 0 
)

◆ set_polyhedron_torus()

bool tools::hep::polyhedron::set_polyhedron_torus ( double  rmin,
double  rmax,
double  rtor,
double  phi,
double  dphi,
int  nphi,
int  nthe 
)

◆ set_polyhedron_trap()

bool tools::hep::polyhedron::set_polyhedron_trap ( double  Dz,
double  Theta,
double  Phi,
double  Dy1,
double  Dx1,
double  Dx2,
double  Alp1,
double  Dy2,
double  Dx3,
double  Dx4,
double  Alp2 
)

◆ set_polyhedron_trd1()

bool tools::hep::polyhedron::set_polyhedron_trd1 ( double  Dx1,
double  Dx2,
double  Dy,
double  Dz 
)
inline

Definition at line 360 of file polyhedron.

361  {
362  return set_polyhedron_trd2(Dx1, Dx2, Dy, Dy, Dz);
363  }

◆ set_polyhedron_trd2()

bool tools::hep::polyhedron::set_polyhedron_trd2 ( double  Dx1,
double  Dx2,
double  Dy1,
double  Dy2,
double  Dz 
)

◆ set_polyhedron_tube()

bool tools::hep::polyhedron::set_polyhedron_tube ( double  Rmin,
double  Rmax,
double  Dz,
int  nstep = 0 
)
inline

Definition at line 347 of file polyhedron.

348  {
349  return set_polyhedron_cons(Rmin, Rmax, Rmin, Rmax, Dz, 0, 2*_M_PI(), nstep);
350  }

◆ set_polyhedron_tubs()

bool tools::hep::polyhedron::set_polyhedron_tubs ( double  Rmin,
double  Rmax,
double  Dz,
double  Phi1,
double  Dphi,
int  nstep 
)
inline

Definition at line 387 of file polyhedron.

390  {//G.Barrand
391  return set_polyhedron_cons(Rmin, Rmax, Rmin, Rmax, Dz, Phi1, Dphi, nstep);
392  }

◆ set_polyhedron_xtru()

bool tools::hep::polyhedron::set_polyhedron_xtru ( int  a_npts,
int  a_nz,
double *  a_xs,
double *  a_ys,
double *  a_zs,
bool  a_acw = true,
bool  a_zfb = true 
)

◆ SetNumberOfRotationSteps()

void tools::hep::polyhedron::SetNumberOfRotationSteps ( int  n)

◆ SetReferences()

void tools::hep::polyhedron::SetReferences ( )
protected

◆ SetSideFacets()

void tools::hep::polyhedron::SetSideFacets ( int  ii[4],
int  vv[4],
int *  kk,
double *  r,
double  dphi,
int  ns,
int &  kface 
)
protected

◆ subtract()

polyhedron tools::hep::polyhedron::subtract ( const polyhedron p) const

◆ Transform() [1/2]

polyhedron& tools::hep::polyhedron::Transform ( const rotd rot,
const vec3d trans 
)

◆ Transform() [2/2]

polyhedron& tools::hep::polyhedron::Transform ( const rotd rot,
double  ,
double  ,
double   
)

◆ Translate()

polyhedron& tools::hep::polyhedron::Translate ( double  ,
double  ,
double   
)

◆ vxy()

double tools::hep::polyhedron::vxy ( const double *  xy,
int  i,
int  j 
)
inline

Definition at line 352 of file polyhedron.

352 {return xy[i*2+j];}

Friends And Related Function Documentation

◆ operator!=

int operator!= ( const polyhedron v1,
const polyhedron v2 
)
friend

◆ operator<<

std::ostream& operator<< ( std::ostream &  ,
const polyhedron ph 
)
friend

◆ operator==

int operator== ( const polyhedron v1,
const polyhedron v2 
)
friend

Member Data Documentation

◆ nface

int tools::hep::polyhedron::nface
protected

Definition at line 157 of file polyhedron.

◆ nvert

int tools::hep::polyhedron::nvert
protected

Definition at line 157 of file polyhedron.

◆ pF

SbFacet* tools::hep::polyhedron::pF
protected

Definition at line 159 of file polyhedron.

◆ pV

HVPoint3D* tools::hep::polyhedron::pV
protected

Definition at line 158 of file polyhedron.


The documentation for this class was generated from the following file:
tools::hep::polyhedron::nface
int nface
Definition: polyhedron:157
tools::hep::polyhedron::set_polyhedron_trd2
bool set_polyhedron_trd2(double Dx1, double Dx2, double Dy1, double Dy2, double Dz)
tools::hep::polyhedron::set_polyhedron_pgon
bool set_polyhedron_pgon(double phi, double dphi, int npdv, int nz, const double *z, const double *rmin, const double *rmax)
tools::hep::Sb_iabs
int Sb_iabs(int a)
Definition: polyhedron:441
tools::hep::HVPoint3D
vec3d HVPoint3D
Definition: polyhedron:37
tools::hep::polyhedron::_M_PI
static double _M_PI()
Definition: polyhedron:164
tools::hep::polyhedron::set_polyhedron_cons
bool set_polyhedron_cons(double Rmn1, double Rmx1, double Rmn2, double Rmx2, double Dz, double Phi1, double Dphi, int nstep=0)
tools::hep::polyhedron::set_polyhedron_trap
bool set_polyhedron_trap(double Dz, double Theta, double Phi, double Dy1, double Dx1, double Dx2, double Alp1, double Dy2, double Dx3, double Dx4, double Alp2)
tools::hep::polyhedron::pF
SbFacet * pF
Definition: polyhedron:159
tools::hep::polyhedron::nvert
int nvert
Definition: polyhedron:157
tools::hep::polyhedron::NUMBER_OF_STEPS
static int NUMBER_OF_STEPS()
Definition: polyhedron:201
tools::hep::polyhedron::pV
HVPoint3D * pV
Definition: polyhedron:158