Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
HepPolyhedronEllipsoid Class Reference

#include <HepPolyhedron.h>

Inheritance diagram for HepPolyhedronEllipsoid:
HepPolyhedron

Public Member Functions

 HepPolyhedronEllipsoid (G4double dx, G4double dy, G4double dz, G4double zcut1, G4double zcut2)
 
virtual ~HepPolyhedronEllipsoid ()
 
- Public Member Functions inherited from HepPolyhedron
 HepPolyhedron ()
 
 HepPolyhedron (const HepPolyhedron &from)
 
virtual ~HepPolyhedron ()
 
HepPolyhedronoperator= (const HepPolyhedron &from)
 
G4int GetNoVertices () const
 
G4int GetNoFacets () const
 
HepPolyhedronTransform (const G4Transform3D &t)
 
G4bool GetNextVertexIndex (G4int &index, G4int &edgeFlag) const
 
G4Point3D GetVertex (G4int index) const
 
G4bool GetNextVertex (G4Point3D &vertex, G4int &edgeFlag) const
 
G4bool GetNextVertex (G4Point3D &vertex, G4int &edgeFlag, G4Normal3D &normal) const
 
G4bool GetNextEdgeIndeces (G4int &i1, G4int &i2, G4int &edgeFlag, G4int &iface1, G4int &iface2) const
 
G4bool GetNextEdgeIndeces (G4int &i1, G4int &i2, G4int &edgeFlag) const
 
G4bool GetNextEdge (G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag) const
 
G4bool GetNextEdge (G4Point3D &p1, G4Point3D &p2, G4int &edgeFlag, G4int &iface1, G4int &iface2) const
 
void GetFacet (G4int iFace, G4int &n, G4int *iNodes, G4int *edgeFlags=0, G4int *iFaces=0) const
 
void GetFacet (G4int iFace, G4int &n, G4Point3D *nodes, G4int *edgeFlags=0, G4Normal3D *normals=0) const
 
G4bool GetNextFacet (G4int &n, G4Point3D *nodes, G4int *edgeFlags=0, G4Normal3D *normals=0) const
 
G4Normal3D GetNormal (G4int iFace) const
 
G4Normal3D GetUnitNormal (G4int iFace) const
 
G4bool GetNextNormal (G4Normal3D &normal) const
 
G4bool GetNextUnitNormal (G4Normal3D &normal) const
 
HepPolyhedron add (const HepPolyhedron &p) const
 
HepPolyhedron subtract (const HepPolyhedron &p) const
 
HepPolyhedron intersect (const HepPolyhedron &p) const
 
G4double GetSurfaceArea () const
 
G4double GetVolume () const
 
G4int createTwistedTrap (G4double Dz, const G4double xy1[][2], const G4double xy2[][2])
 
G4int createPolyhedron (G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
 

Additional Inherited Members

- Static Public Member Functions inherited from HepPolyhedron
static G4int GetNumberOfRotationSteps ()
 
static void SetNumberOfRotationSteps (G4int n)
 
static void ResetNumberOfRotationSteps ()
 
- Protected Member Functions inherited from HepPolyhedron
void AllocateMemory (G4int Nvert, G4int Nface)
 
G4int FindNeighbour (G4int iFace, G4int iNode, G4int iOrder) const
 
G4Normal3D FindNodeNormal (G4int iFace, G4int iNode) const
 
void CreatePrism ()
 
void RotateEdge (G4int k1, G4int k2, G4double r1, G4double r2, G4int v1, G4int v2, G4int vEdge, G4bool ifWholeCircle, G4int ns, G4int &kface)
 
void SetSideFacets (G4int ii[4], G4int vv[4], G4int *kk, G4double *r, G4double dphi, G4int ns, G4int &kface)
 
void RotateAroundZ (G4int nstep, G4double phi, G4double dphi, G4int np1, G4int np2, const G4double *z, G4double *r, G4int nodeVis, G4int edgeVis)
 
void SetReferences ()
 
void InvertFacets ()
 
- Protected Attributes inherited from HepPolyhedron
G4int nvert
 
G4int nface
 
G4Point3DpV
 
G4FacetpF
 
- Static Protected Attributes inherited from HepPolyhedron
static G4ThreadLocal G4int fNumberOfRotationSteps = DEFAULT_NUMBER_OF_STEPS
 

Detailed Description

Definition at line 497 of file HepPolyhedron.h.

Constructor & Destructor Documentation

HepPolyhedronEllipsoid::HepPolyhedronEllipsoid ( G4double  dx,
G4double  dy,
G4double  dz,
G4double  zcut1,
G4double  zcut2 
)

Definition at line 2058 of file HepPolyhedron.cc.

References test::a, FatalException, G4Exception(), HepPolyhedron::GetNumberOfRotationSteps(), HepPolyhedron::nvert, python.hepunit::pi, HepPolyhedron::pV, HepPolyhedron::RotateAroundZ(), HepPolyhedron::SetReferences(), HepGeom::BasicVector3D< T >::setX(), HepGeom::BasicVector3D< T >::setY(), python.hepunit::twopi, HepGeom::BasicVector3D< T >::x(), and HepGeom::BasicVector3D< T >::y().

2075 {
2076  // C H E C K I N P U T P A R A M E T E R S
2077 
2078  if (zCut1 >= cz || zCut2 <= -cz || zCut1 > zCut2) {
2079  std::cerr << "HepPolyhedronEllipsoid: wrong zCut1 = " << zCut1
2080  << " zCut2 = " << zCut2
2081  << " for given cz = " << cz << std::endl;
2082  return;
2083  }
2084  if (cz <= 0.0) {
2085  std::cerr << "HepPolyhedronEllipsoid: bad z semi-axis: cz = " << cz
2086  << std::endl;
2087  return;
2088  }
2089 
2090  G4double dthe;
2091  G4double sthe;
2092  G4int cutflag;
2093  cutflag= 0;
2094  if (zCut2 >= cz)
2095  {
2096  sthe= 0.0;
2097  }
2098  else
2099  {
2100  sthe= std::acos(zCut2/cz);
2101  cutflag++;
2102  }
2103  if (zCut1 <= -cz)
2104  {
2105  dthe= pi - sthe;
2106  }
2107  else
2108  {
2109  dthe= std::acos(zCut1/cz)-sthe;
2110  cutflag++;
2111  }
2112 
2113  // P R E P A R E T W O P O L Y L I N E S
2114  // generate sphere of radius cz first, then rescale x and y later
2115 
2116  G4int nds = (GetNumberOfRotationSteps() + 1) / 2;
2117  G4int np1 = G4int(dthe*nds/pi) + 2 + cutflag;
2118 
2119  G4double *zz, *rr;
2120  zz = new G4double[np1+1];
2121  rr = new G4double[np1+1];
2122  if (!zz || !rr)
2123  {
2124  G4Exception("HepPolyhedronEllipsoid::HepPolyhedronEllipsoid",
2125  "greps1002", FatalException, "Out of memory");
2126  }
2127 
2128  G4double a = dthe/(np1-cutflag-1);
2129  G4double cosa, sina;
2130  G4int j=0;
2131  if (sthe > 0.0)
2132  {
2133  zz[j]= zCut2;
2134  rr[j]= 0.;
2135  j++;
2136  }
2137  for (G4int i=0; i<np1-cutflag; i++) {
2138  cosa = std::cos(sthe+i*a);
2139  sina = std::sin(sthe+i*a);
2140  zz[j] = cz*cosa;
2141  rr[j] = cz*sina;
2142  j++;
2143  }
2144  if (j < np1)
2145  {
2146  zz[j]= zCut1;
2147  rr[j]= 0.;
2148  j++;
2149  }
2150  if (j > np1)
2151  {
2152  std::cerr << "Logic error in HepPolyhedronEllipsoid, memory corrupted!"
2153  << std::endl;
2154  }
2155  if (j < np1)
2156  {
2157  std::cerr << "Warning: logic error in HepPolyhedronEllipsoid."
2158  << std::endl;
2159  np1= j;
2160  }
2161  zz[j] = 0.;
2162  rr[j] = 0.;
2163 
2164 
2165  // R O T A T E P O L Y L I N E S
2166 
2167  RotateAroundZ(0, 0.0, twopi, np1, 1, zz, rr, -1, 1);
2168  SetReferences();
2169 
2170  delete [] zz;
2171  delete [] rr;
2172 
2173  // rescale x and y vertex coordinates
2174  {
2175  G4Point3D * p= pV;
2176  for (G4int i=0; i<nvert; i++, p++) {
2177  p->setX( p->x() * ax/cz );
2178  p->setY( p->y() * by/cz );
2179  }
2180  }
2181 }
const char * p
Definition: xmltok.h:285
int G4int
Definition: G4Types.hh:78
G4Point3D * pV
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
Definition: G4Exception.cc:41
void RotateAroundZ(G4int nstep, G4double phi, G4double dphi, G4int np1, G4int np2, const G4double *z, G4double *r, G4int nodeVis, G4int edgeVis)
void SetReferences()
static G4int GetNumberOfRotationSteps()
double G4double
Definition: G4Types.hh:76
HepPolyhedronEllipsoid::~HepPolyhedronEllipsoid ( )
virtual

Definition at line 2183 of file HepPolyhedron.cc.

2183 {}

The documentation for this class was generated from the following files: