inlib
1.2.0
|
00001 // Copyright (C) 2010, Guy Barrand. All rights reserved. 00002 // See the file inlib.license for terms. 00003 00004 #ifndef inlib_hep_polyhedron 00005 #define inlib_hep_polyhedron 00006 00007 // see (lengthy) doc and disclaimer at end. 00008 00009 #include "../vec3d" 00010 #include "../rotd" 00011 00012 #include <string> 00013 #include <iostream> 00014 #include <vector> 00015 00016 namespace inlib { 00017 namespace hep { 00018 00019 typedef inlib::vec3d HVPoint3D; 00020 typedef HVPoint3D HVNormal3D; 00021 typedef HVPoint3D HVVector3D; 00022 00023 class SbFacet { 00024 friend class polyhedron; 00025 #ifndef SWIG 00026 friend std::ostream& operator<<(std::ostream&, const SbFacet &facet); 00027 //G.Barrand 00028 friend int operator == (const SbFacet & v1, const SbFacet & v2); 00029 friend int operator != (const SbFacet & v1, const SbFacet & v2); 00030 #endif 00031 00032 private: 00033 typedef struct { int v,f; } edge_t; //G.Barrand 00034 edge_t edge[4]; 00035 00036 public: 00037 SbFacet(int v1=0, int f1=0, int v2=0, int f2=0, 00038 int v3=0, int f3=0, int v4=0, int f4=0) 00039 { edge[0].v=v1; edge[0].f=f1; edge[1].v=v2; edge[1].f=f2; 00040 edge[2].v=v3; edge[2].f=f3; edge[3].v=v4; edge[3].f=f4; } 00041 00042 SbFacet(const SbFacet & aFrom) { 00043 edge[0].v = aFrom.edge[0].v; 00044 edge[0].f = aFrom.edge[0].f; 00045 edge[1].v = aFrom.edge[1].v; 00046 edge[1].f = aFrom.edge[1].f; 00047 edge[2].v = aFrom.edge[2].v; 00048 edge[2].f = aFrom.edge[2].f; 00049 edge[3].v = aFrom.edge[3].v; 00050 edge[3].f = aFrom.edge[3].f; 00051 } 00052 SbFacet& operator=(const SbFacet& aFrom) { 00053 edge[0].v = aFrom.edge[0].v; 00054 edge[0].f = aFrom.edge[0].f; 00055 edge[1].v = aFrom.edge[1].v; 00056 edge[1].f = aFrom.edge[1].f; 00057 edge[2].v = aFrom.edge[2].v; 00058 edge[2].f = aFrom.edge[2].f; 00059 edge[3].v = aFrom.edge[3].v; 00060 edge[3].f = aFrom.edge[3].f; 00061 return *this; 00062 } 00063 bool isEqual(const SbFacet& aFrom) const { //G.Barrand 00064 if(edge[0].v!=aFrom.edge[0].v) return false; 00065 if(edge[0].f!=aFrom.edge[0].f) return false; 00066 00067 if(edge[1].v!=aFrom.edge[1].v) return false; 00068 if(edge[1].f!=aFrom.edge[1].f) return false; 00069 00070 if(edge[2].v!=aFrom.edge[2].v) return false; 00071 if(edge[2].f!=aFrom.edge[2].f) return false; 00072 00073 if(edge[3].v!=aFrom.edge[3].v) return false; 00074 if(edge[3].f!=aFrom.edge[3].f) return false; 00075 00076 return true; 00077 } 00078 void GetEdge(int i,int& v,int& f) const { //G.Barrand 00079 v = edge[i].v; 00080 f = edge[i].f; 00081 } 00082 00083 void Set(int v[8]) //G.Barrand 00084 { edge[0].v = v[0]; edge[0].f = v[1]; 00085 edge[1].v = v[2]; edge[1].f = v[3]; 00086 edge[2].v = v[4]; edge[2].f = v[5]; 00087 edge[3].v = v[6]; edge[3].f = v[7]; } 00088 }; 00089 00090 //G.Barrand : 00091 //int operator == (const SbFacet & v1, const SbFacet & v2); 00092 //int operator != (const SbFacet & v1, const SbFacet & v2); 00093 00094 class polyhedron { 00095 #ifndef SWIG 00096 friend std::ostream& operator<<(std::ostream&, const polyhedron &ph); 00097 //G.Barrand 00098 friend int operator == (const polyhedron & v1, const polyhedron & v2); 00099 friend int operator != (const polyhedron & v1, const polyhedron & v2); 00100 #endif 00101 00102 private: //G.Barrand 00103 std::string* m_name; //have a pointer to optimize memory. 00104 protected: 00105 int nvert, nface; 00106 HVPoint3D *pV; 00107 SbFacet *pF; 00108 private: 00109 int fNumberOfRotationSteps; 00110 00111 protected: 00112 // Allocate memory for polyhedron 00113 void AllocateMemory(int Nvert, int Nface); 00114 00115 // Find neighbouring facet 00116 int FindNeighbour(int iFace, int iNode, int iOrder) const; 00117 00118 // Find normal at node 00119 HVNormal3D FindNodeNormal(int iFace, int iNode) const; 00120 00121 // Create polyhedron for prism with quadrilateral base 00122 void CreatePrism(); 00123 00124 // Generate facets by revolving an edge around Z-axis 00125 void RotateEdge(int k1, int k2, double r1, double r2, 00126 int v1, int v2, int vEdge, 00127 bool ifWholeCircle, int ns, int &kface); 00128 00129 // Set side facets for the case of incomplete rotation 00130 void SetSideFacets(int ii[4], int vv[4], 00131 int *kk, double *r, 00132 double dphi, int ns, int &kface); 00133 00134 // Create polyhedron for body of revolution around Z-axis 00135 void RotateAroundZ(int nstep, double phi, double dphi, 00136 int np1, int np2, 00137 const double *z, double *r, 00138 int nodeVis, int edgeVis); 00139 00140 // For each edge set reference to neighbouring facet 00141 void SetReferences(); 00142 00143 // Invert the order on nodes in facets 00144 void InvertFacets(); 00145 private: 00146 static int NUMBER_OF_STEPS() {return 24;} 00147 00148 public: 00149 polyhedron(int Nvert=0, int Nface=0) 00150 : m_name(0) //G.Barrand 00151 ,nvert(Nvert),nface(Nface) 00152 ,pV(Nvert ? new HVPoint3D[Nvert+1] : 0) 00153 ,pF(Nface ? new SbFacet[Nface+1] : 0) 00154 ,fNumberOfRotationSteps(NUMBER_OF_STEPS()) 00155 {} 00156 public: 00157 polyhedron(const polyhedron & from); 00158 polyhedron& operator=(const polyhedron & from); 00159 virtual ~polyhedron() { 00160 delete m_name; //G.Barrand. 00161 delete [] pV; delete [] pF; 00162 } 00163 public: 00164 //G.Barrand : handle a name to help debugging. 00165 void setName(const std::string& aName) { 00166 delete m_name; 00167 m_name = new std::string(aName); 00168 } 00169 std::string getName() const { 00170 if(!m_name) return std::string(); 00171 return *m_name; 00172 } 00173 //G.Barrand :end 00174 00175 void Set(int Nvert, HVPoint3D* aV, 00176 int Nface, SbFacet* aF) //G.Barrand 00177 { delete [] pV; delete [] pF; 00178 nvert = Nvert; nface = Nface; pV = aV; pF = aF;} 00179 00180 void Empty() //G.Barrand 00181 { nvert = 0; nface = 0; pV = 0;pF = 0;} 00182 00183 // Get number of vertices 00184 int GetNoVertices() const { return nvert; } 00185 00186 // Get number of facets 00187 int GetNoFacets() const { return nface; } 00188 00189 // Transform the polyhedron 00190 polyhedron& Transform(const inlib::rotd& rot, 00191 const inlib::vec3d& trans); 00192 00193 // Get next vertex index of the quadrilateral 00194 //G.Barrand 00195 bool GetNextVertexIndex(int & index, int & edgeFlag) const; 00196 00197 // Get vertex by index 00198 HVPoint3D GetVertex(int index) const; 00199 const HVPoint3D& GetVertexFast(int index) const; //G.Barrand 00200 00201 //G.Barrand : to optimize SoPolyhedron. 00202 HVPoint3D* GetPV() const {return pV;} //G.Barrand 00203 SbFacet* GetPF() const {return pF;} //G.Barrand 00204 00205 // Get next vertex + edge visibility of the quadrilateral 00206 bool GetNextVertex(HVPoint3D & vertex, int & edgeFlag) const; 00207 00208 // Get next vertex + edge visibility + normal of the quadrilateral 00209 bool GetNextVertex(HVPoint3D & vertex, int & edgeFlag, 00210 HVNormal3D & normal) const; 00211 00212 // Get indeces of the next edge with indeces of the faces 00213 bool GetNextEdgeIndeces(int & i1, int & i2, int & edgeFlag, 00214 int & iface1, int & iface2) const; 00215 00216 // Get indeces of the next edge 00217 bool GetNextEdgeIndeces(int & i1, int & i2, int & edgeFlag) const; 00218 00219 // Get next edge 00220 bool GetNextEdge(HVPoint3D &p1, HVPoint3D &p2, int &edgeFlag) const; 00221 00222 // Get next edge 00223 bool GetNextEdge(HVPoint3D &p1, HVPoint3D &p2, int &edgeFlag, 00224 int &iface1, int &iface2) const; 00225 00226 // Get face by index 00227 void GetFacet(int iFace, int &n, int *iNodes, 00228 int *edgeFlags = 0, int *iFaces = 0) const; 00229 00230 // Get face by index 00231 void GetFacet(int iFace, int &n, HVPoint3D *nodes, 00232 int *edgeFlags = 0, HVNormal3D *normals = 0) const; 00233 00234 // Get next face with normals at the nodes 00235 bool GetNextFacet(int &n, HVPoint3D *nodes, 00236 int *edgeFlags=0, HVNormal3D *normals=0) const; 00237 00238 // Get normal of the face given by index 00239 HVNormal3D GetNormal(int iFace) const; 00240 00241 // Get unit normal of the face given by index 00242 HVNormal3D GetUnitNormal(int iFace) const; 00243 00244 // Get normal of the next face 00245 bool GetNextNormal(HVNormal3D &normal) const; 00246 00247 // Get normal of unit length of the next face 00248 bool GetNextUnitNormal(HVNormal3D &normal) const; 00249 00250 // Boolean operations 00251 polyhedron add(const polyhedron &p) const; 00252 polyhedron subtract(const polyhedron &p) const; 00253 polyhedron intersect(const polyhedron &p) const; 00254 00255 // Get area of the surface of the polyhedron 00256 double GetSurfaceArea() const; 00257 00258 // Get volume of the polyhedron 00259 double GetVolume() const; 00260 00261 bool isEqual(const polyhedron &p) const; //G.Barrand 00262 bool isConsistent(const char* = 0) const; //G.Barrand 00263 void dump() const; 00264 00265 // Get number of steps for whole circle 00266 int GetNumberOfRotationSteps(); //G.Barrand : no more static. 00267 00268 // Set number of steps for whole circle 00269 void SetNumberOfRotationSteps(int n); 00270 00271 // Reset number of steps for whole circle to default value 00272 void ResetNumberOfRotationSteps(); //G.Barrand : have code in .cxx. 00273 private: //G.Barrand 00274 bool CHECK_INDEX(const char* a_method,int a_index) const; 00275 }; 00276 00277 //G.Barrand : 00278 //int operator == (const polyhedron & v1, const polyhedron & v2); 00279 //int operator != (const polyhedron & v1, const polyhedron & v2); 00280 00281 // G.Barrand : introduce iabs to avoid a mess with cmath and some compiler. 00282 inline int Sb_iabs(int a) { 00283 return a < 0 ? -a : a; 00284 } 00285 00286 inline //G.Barrand 00287 bool polyhedron::GetNextVertexIndex(int &index, int &edgeFlag) const 00288 /*********************************************************************** 00289 * * 00290 * Name: polyhedron::GetNextVertexIndex Date: 03.09.96 * 00291 * Author: Yasuhide Sawada Revised: * 00292 * * 00293 * Function: * 00294 * * 00295 ***********************************************************************/ 00296 { 00297 static int iFace = 1; 00298 static int iQVertex = 0; 00299 //G.Barrand : int vIndex = pF[iFace].edge[iQVertex].v; 00300 SbFacet::edge_t* edge = pF[iFace].edge; //G.Barrand : optimize. 00301 int vIndex = edge[iQVertex].v; 00302 00303 edgeFlag = (vIndex > 0) ? 1 : 0; 00304 index = Sb_iabs(vIndex); 00305 00306 if(index>nvert) { 00307 std::cerr << "polyhedron::GetNextVertexIndex: pV index problem " 00308 << index << " exceed " << nvert << std::endl; 00309 index = 0; 00310 } 00311 00312 //G.Barrand : if (iQVertex >= 3 || pF[iFace].edge[iQVertex+1].v == 0) { 00313 if (iQVertex >= 3 || edge[iQVertex+1].v == 0) { 00314 iQVertex = 0; 00315 if (++iFace > nface) iFace = 1; 00316 return false; // Last Edge 00317 }else{ 00318 ++iQVertex; 00319 return true; // not Last Edge 00320 } 00321 } 00322 00323 class polyhedronTrd2 : public polyhedron { 00324 public: 00325 polyhedronTrd2(double Dx1, double Dx2, 00326 double Dy1, double Dy2, double Dz); 00327 virtual ~polyhedronTrd2(){} 00328 virtual polyhedron& operator = (const polyhedron& from) { 00329 return polyhedron::operator = (from); 00330 } 00331 }; 00332 00333 class polyhedronTrd1 : public polyhedronTrd2 { 00334 public: 00335 polyhedronTrd1(double Dx1, double Dx2, 00336 double Dy, double Dz); 00337 virtual ~polyhedronTrd1(){} 00338 virtual polyhedron& operator = (const polyhedron& from) { 00339 return polyhedron::operator = (from); 00340 } 00341 }; 00342 00343 class polyhedronBox : public polyhedronTrd2 { 00344 public: 00345 polyhedronBox(double Dx, double Dy, double Dz); 00346 virtual ~polyhedronBox(){} 00347 virtual polyhedron& operator = (const polyhedron& from) { 00348 return polyhedron::operator = (from); 00349 } 00350 }; 00351 00352 class polyhedronTrap : public polyhedron { 00353 public: 00354 polyhedronTrap(double Dz, double Theta, double Phi, 00355 double Dy1, 00356 double Dx1, double Dx2, double Alp1, 00357 double Dy2, 00358 double Dx3, double Dx4, double Alp2); 00359 virtual ~polyhedronTrap(){} 00360 virtual polyhedron& operator = (const polyhedron& from) { 00361 return polyhedron::operator = (from); 00362 } 00363 }; 00364 00365 class polyhedronPara : public polyhedronTrap { 00366 public: 00367 polyhedronPara(double Dx, double Dy, double Dz, 00368 double Alpha, double Theta, double Phi); 00369 virtual ~polyhedronPara(){} 00370 virtual polyhedron& operator = (const polyhedron& from) { 00371 return polyhedron::operator = (from); 00372 } 00373 }; 00374 00375 class polyhedronCons : public polyhedron { 00376 public: 00377 polyhedronCons(double Rmn1, double Rmx1, 00378 double Rmn2, double Rmx2, double Dz, 00379 double Phi1, double Dphi, 00380 int nstep = 0); //G.Barrand 00381 virtual ~polyhedronCons(){} 00382 virtual polyhedron& operator = (const polyhedron& from) { 00383 return polyhedron::operator = (from); 00384 } 00385 }; 00386 00387 class polyhedronCone : public polyhedronCons { 00388 public: 00389 polyhedronCone(double Rmn1, double Rmx1, 00390 double Rmn2, double Rmx2, double Dz, 00391 int nstep = 0); //G.Barrand 00392 virtual ~polyhedronCone(){} 00393 virtual polyhedron& operator = (const polyhedron& from) { 00394 return polyhedron::operator = (from); 00395 } 00396 }; 00397 00398 class polyhedronTubs : public polyhedronCons { 00399 public: 00400 polyhedronTubs(double Rmin, double Rmax, double Dz, 00401 double Phi1, double Dphi, 00402 int nstep = 0); //G.Barrand 00403 virtual ~polyhedronTubs(){} 00404 virtual polyhedron& operator = (const polyhedron& from) { 00405 return polyhedron::operator = (from); 00406 } 00407 }; 00408 00409 class polyhedronTube : public polyhedronCons { 00410 public: 00411 polyhedronTube (double Rmin, double Rmax, double Dz, 00412 int nstep = 0); //G.Barrand 00413 virtual ~polyhedronTube(){} 00414 virtual polyhedron& operator = (const polyhedron& from) { 00415 return polyhedron::operator = (from); 00416 } 00417 }; 00418 00419 class polyhedronPgon : public polyhedron { 00420 public: 00421 polyhedronPgon(double phi, double dphi, int npdv, int nz, 00422 const double *z, 00423 const double *rmin, 00424 const double *rmax); 00425 virtual ~polyhedronPgon(){} 00426 virtual polyhedron& operator = (const polyhedron& from) { 00427 return polyhedron::operator = (from); 00428 } 00429 }; 00430 00431 class polyhedronPcon : public polyhedronPgon { 00432 public: 00433 polyhedronPcon(double phi, double dphi, int nz, 00434 const double *z, 00435 const double *rmin, 00436 const double *rmax); 00437 virtual ~polyhedronPcon(){} 00438 virtual polyhedron& operator = (const polyhedron& from) { 00439 return polyhedron::operator = (from); 00440 } 00441 }; 00442 00443 class polyhedronSphere : public polyhedron { 00444 public: 00445 polyhedronSphere(double rmin, double rmax, 00446 double phi, double dphi, 00447 double the, double dthe, 00448 int nphi = 0, 00449 int nthe = 0); //G.Barrand 00450 virtual ~polyhedronSphere(){} 00451 virtual polyhedron& operator = (const polyhedron& from) { 00452 return polyhedron::operator = (from); 00453 } 00454 }; 00455 00456 class polyhedronTorus : public polyhedron { 00457 public: 00458 polyhedronTorus(double rmin, double rmax, double rtor, 00459 double phi, double dphi, 00460 int nphi = 0, 00461 int nthe = 0); //G.Barrand 00462 virtual ~polyhedronTorus(){} 00463 virtual polyhedron& operator = (const polyhedron& from) { 00464 return polyhedron::operator = (from); 00465 } 00466 }; 00467 00468 //G.Barrand : begin 00469 class polyhedronProcessor { 00470 public: 00471 enum Operation { //Must be the same than BooleanProcessor OP_XXX. 00472 UNION = 0 00473 ,INTERSECTION = 1 00474 ,SUBTRACTION = 2 00475 }; 00476 private: 00477 typedef std::pair<Operation,polyhedron> op_t; 00478 public: 00479 polyhedronProcessor(){} 00480 virtual ~polyhedronProcessor(){} 00481 private: 00482 polyhedronProcessor(const polyhedronProcessor&){} 00483 polyhedronProcessor& operator=(const polyhedronProcessor&){return *this;} 00484 public: 00485 void push_back(Operation a_op,const polyhedron& a_polyhedron) { 00486 m_ops.push_back(op_t(a_op,a_polyhedron)); 00487 } 00488 bool execute(polyhedron&); 00489 void clear() { m_ops.clear();} 00490 bool is_same_op() const { 00491 if(!m_ops.size()) return true; 00492 Operation op = m_ops[0].first; 00493 std::vector<op_t>::const_iterator it; 00494 for(it=m_ops.begin();it!=m_ops.end();++it) { 00495 if((*it).first!=op) return false; 00496 } 00497 return true; 00498 } 00499 00500 //private: 00501 bool execute1(polyhedron&,const std::vector<unsigned int>&); 00502 private: 00503 std::vector<op_t> m_ops; 00504 }; 00505 //G.Barrand : end 00506 00507 }} 00508 00509 #endif 00510 00511 #include "polyhedron.icc" 00512 00513 //--------------------------------------------------------------------// 00514 // JFB: // 00515 // polyhedron was HepPolyhedron, retrofitted to Open Inventor // 00516 // infrastructure: // 00517 //--------------------------------------------------------------------// 00518 00519 00520 // ******************************************************************** 00521 // * DISCLAIMER * 00522 // * * 00523 // * The following disclaimer summarizes all the specific disclaimers * 00524 // * of contributors to this software. The specific disclaimers,which * 00525 // * govern, are listed with their locations in: * 00526 // * http://cern.ch/geant4/license * 00527 // * * 00528 // * Neither the authors of this software system, nor their employing * 00529 // * institutes,nor the agencies providing financial support for this * 00530 // * work make any representation or warranty, express or implied, * 00531 // * regarding this software system or assume any liability for its * 00532 // * use. * 00533 // * * 00534 // * This code implementation is the intellectual property of the * 00535 // * GEANT4 collaboration. * 00536 // * By copying, distributing or modifying the Program (or any work * 00537 // * based on the Program) you indicate your acceptance of this * 00538 // * statement, and all its terms. * 00539 // ******************************************************************** 00540 // 00541 // 00542 // 00543 // 00544 // Class Description: 00545 // polyhedron is an intermediate class between description of a shape 00546 // and visualization systems. It is intended to provide some service like: 00547 // - polygonization of shapes with triangulization (quadrilaterization) 00548 // of complex polygons; 00549 // - calculation of normals for faces and vertices; 00550 // - finding result of boolean operation on polyhedra; 00551 // 00552 // Public constructors: 00553 // 00554 // polyhedronBox (dx,dy,dz) 00555 // - create polyhedron for Box; 00556 // polyhedronTrd1 (dx1,dx2,dy,dz) 00557 // - create polyhedron for G3 Trd1; 00558 // polyhedronTrd2 (dx1,dx2,dy1,dy2,dz) 00559 // - create polyhedron for G3 Trd2; 00560 // polyhedronTrap (dz,theta,phi, h1,bl1,tl1,alp1, h2,bl2,tl2,alp2) 00561 // - create polyhedron for G3 Trap; 00562 // polyhedronPara (dx,dy,dz,alpha,theta,phi) 00563 // - create polyhedron for G3 Para; 00564 // polyhedronTube (rmin,rmax,dz,nstep=0) 00565 // - create polyhedron for G3 Tube; 00566 // polyhedronTubs (rmin,rmax,dz,phi1,dphi,nstep=0) 00567 // - create polyhedron for G3 Tubs; 00568 // polyhedronCone (rmin1,rmax1,rmin2,rmax2,dz,nstep=0) 00569 // - create polyhedron for G3 Cone; 00570 // polyhedronCons (rmin1,rmax1,rmin2,rmax2,dz,phi1,dphi,nstep=0) 00571 // - create polyhedron for G3 Cons; 00572 // polyhedronPgon (phi,dphi,npdv,nz, z(*),rmin(*),rmax(*)) 00573 // - create polyhedron for G3 Pgon; 00574 // polyhedronPcon (phi,dphi,nz, z(*),rmin(*),rmax(*)) 00575 // - create polyhedron for G3 Pcon; 00576 // polyhedronSphere (rmin,rmax,phi,dphi,the,dthe,nstep=0) 00577 // - create polyhedron for Sphere; 00578 // polyhedronTorus (rmin,rmax,rtor,phi,dphi,nstep=0) 00579 // - create polyhedron for Torus; 00580 // Public functions: 00581 // 00582 // GetNoVertices () - returns number of vertices; 00583 // GetNoFacets () - returns number of faces; 00584 // GetNextVertexIndex (index,edgeFlag) - get vertex indeces of the 00585 // quadrilaterals in order; 00586 // returns false when finished each face; 00587 // GetVertex (index) - returns vertex by index; 00588 // GetNextVertex (vertex,edgeFlag) - get vertices with edge visibility 00589 // of the quadrilaterals in order; 00590 // returns false when finished each face; 00591 // GetNextVertex (vertex,edgeFlag,normal) - get vertices with edge 00592 // visibility and normal of the quadrilaterals 00593 // in order; returns false when finished each face; 00594 // GetNextEdgeIndeces (i1,i2,edgeFlag) - get indeces of the next edge; 00595 // returns false for the last edge; 00596 // GetNextEdgeIndeces (i1,i2,edgeFlag,iface1,iface2) - get indeces of 00597 // the next edge with indeces of the faces 00598 // to which the edge belongs; 00599 // returns false for the last edge; 00600 // GetNextEdge (p1,p2,edgeFlag) - get next edge; 00601 // returns false for the last edge; 00602 // GetNextEdge (p1,p2,edgeFlag,iface1,iface2) - get next edge with indeces 00603 // of the faces to which the edge belongs; 00604 // returns false for the last edge; 00605 // GetFacet (index,n,nodes,edgeFlags=0,normals=0) - get face by index; 00606 // GetNextFacet (n,nodes,edgeFlags=0,normals=0) - get next face with normals 00607 // at the nodes; returns false for the last face; 00608 // GetNormal (index) - get normal of face given by index; 00609 // GetUnitNormal (index) - get unit normal of face given by index; 00610 // GetNextNormal (normal) - get normals of each face in order; 00611 // returns false when finished all faces; 00612 // GetNextUnitNormal (normal) - get normals of unit length of each face 00613 // in order; returns false when finished all faces; 00614 // GetSurfaceArea() - get surface area of the polyhedron; 00615 // GetVolume() - get volume of the polyhedron; 00616 // GetNumberOfRotationSteps() - get number of steps for whole circle; 00617 // SetNumberOfRotationSteps (n) - set number of steps for whole circle; 00618 // ResetNumberOfRotationSteps() - reset number of steps for whole circle 00619 // to default value; 00620 // History: 00621 // 00622 // 20.06.96 Evgeni Chernyaev <Evgueni.Tcherniaev@cern.ch> - initial version 00623 // 00624 // 23.07.96 John Allison 00625 // - added GetNoVertices, GetNoFacets, GetNextVertex, GetNextNormal 00626 // 00627 // 30.09.96 E.Chernyaev 00628 // - added GetNextVertexIndex, GetVertex by Yasuhide Sawada 00629 // - added GetNextUnitNormal, GetNextEdgeIndeces, GetNextEdge 00630 // - improvements: angles now expected in radians 00631 // int -> G4int, double -> G4double 00632 // - G4ThreeVector replaced by either G4Point3D or G4Normal3D 00633 // 00634 // 15.12.96 E.Chernyaev 00635 // - private functions G4PolyhedronAlloc, G4PolyhedronPrism renamed 00636 // to AllocateMemory and CreatePrism 00637 // - added private functions GetNumberOfRotationSteps, RotateEdge, 00638 // RotateAroundZ, SetReferences 00639 // - rewritten G4PolyhedronCons; 00640 // - added G4PolyhedronPara, ...Trap, ...Pgon, ...Pcon, ...Sphere, ...Torus, 00641 // so full List of implemented shapes now looks like: 00642 // BOX, TRD1, TRD2, TRAP, TUBE, TUBS, CONE, CONS, PARA, PGON, PCON, 00643 // SPHERE, TORUS 00644 // 00645 // 01.06.97 E.Chernyaev 00646 // - RotateAroundZ modified and SetSideFacets added to allow Rmin=Rmax 00647 // in bodies of revolution 00648 // 00649 // 24.06.97 J.Allison 00650 // - added static private member fNumberOfRotationSteps and static public 00651 // functions void SetNumberOfRotationSteps (G4int n) and 00652 // void ResetNumberOfRotationSteps (). Modified 00653 // GetNumberOfRotationSteps() appropriately. Made all three functions 00654 // inline (at end of this .hh file). 00655 // Usage: 00656 // G4Polyhedron::SetNumberOfRotationSteps 00657 // (fpView -> GetViewParameters ().GetNoOfSides ()); 00658 // pPolyhedron = solid.CreatePolyhedron (); 00659 // G4Polyhedron::ResetNumberOfRotationSteps (); 00660 // 00661 // 19.03.00 E.Chernyaev 00662 // - added boolean operations (add, subtract, intersect) on polyhedra; 00663 // 00664 // 25.05.01 E.Chernyaev 00665 // - added GetSurfaceArea() and GetVolume(); 00666 // 00667