[830] | 1 | // |
---|
| 2 | // ******************************************************************** |
---|
| 3 | // * License and Disclaimer * |
---|
| 4 | // * * |
---|
| 5 | // * The Geant4 software is copyright of the Copyright Holders of * |
---|
| 6 | // * the Geant4 Collaboration. It is provided under the terms and * |
---|
| 7 | // * conditions of the Geant4 Software License, included in the file * |
---|
| 8 | // * LICENSE and available at http://cern.ch/geant4/license . These * |
---|
| 9 | // * include a list of copyright holders. * |
---|
| 10 | // * * |
---|
| 11 | // * Neither the authors of this software system, nor their employing * |
---|
| 12 | // * institutes,nor the agencies providing financial support for this * |
---|
| 13 | // * work make any representation or warranty, express or implied, * |
---|
| 14 | // * regarding this software system or assume any liability for its * |
---|
| 15 | // * use. Please see the license in the file LICENSE and URL above * |
---|
| 16 | // * for the full disclaimer and the limitation of liability. * |
---|
| 17 | // * * |
---|
| 18 | // * This code implementation is the result of the scientific and * |
---|
| 19 | // * technical work of the GEANT4 collaboration. * |
---|
| 20 | // * By using, copying, modifying or distributing the software (or * |
---|
| 21 | // * any work based on the software) you agree to acknowledge its * |
---|
| 22 | // * use in resulting scientific publications, and indicate your * |
---|
| 23 | // * acceptance of all terms of the Geant4 Software license. * |
---|
| 24 | // ******************************************************************** |
---|
| 25 | // |
---|
| 26 | // |
---|
[850] | 27 | // $Id: G4Polyhedron.hh,v 1.21 2008/04/14 08:50:23 gcosmo Exp $ |
---|
| 28 | // GEANT4 tag $Name: HEAD $ |
---|
[830] | 29 | |
---|
| 30 | #ifndef G4POLYHEDRON_HH |
---|
| 31 | #define G4POLYHEDRON_HH |
---|
| 32 | |
---|
| 33 | // Class Description: |
---|
| 34 | // G4Polyhedron is an intermediate class between G4 and visualization |
---|
| 35 | // systems. It is intended to provide some service like: |
---|
| 36 | // - polygonization of the G4 shapes with triangulization |
---|
| 37 | // (quadrilaterization) of complex polygons; |
---|
| 38 | // - calculation of normals for faces and vertices. |
---|
| 39 | // |
---|
| 40 | // Inherits from HepPolyhedron, to which reference should be made for |
---|
| 41 | // functionality. |
---|
| 42 | // |
---|
| 43 | // Public constructors: |
---|
| 44 | // G4PolyhedronBox(dx,dy,dz) - create G4Polyhedron for G4 Box; |
---|
| 45 | // G4PolyhedronTrd1(dx1,dx2,dy,dz) - create G4Polyhedron for G4 Trd1; |
---|
| 46 | // G4PolyhedronTrd2(dx1,dx2,dy1,dy2,dz) - create G4Polyhedron for G4 Trd2; |
---|
| 47 | // G4PolyhedronTrap(dz,theta,phi, |
---|
| 48 | // h1,bl1,tl1,alp1, |
---|
| 49 | // h2,bl2,tl2,alp2) - create G4Polyhedron for G4 Trap; |
---|
| 50 | // G4PolyhedronPara(dx,dy,dz, |
---|
| 51 | // alpha,theta,phi) - create G4Polyhedron for G4 Para; |
---|
| 52 | // |
---|
| 53 | // G4PolyhedronTube(rmin,rmax,dz) - create G4Polyhedron for G4 Tube; |
---|
| 54 | // G4PolyhedronTubs(rmin,rmax,dz, |
---|
| 55 | // phi1,dphi) - create G4Polyhedron for G4 Tubs; |
---|
| 56 | // G4PolyhedronCone(rmin1,rmax1, |
---|
| 57 | // rmin2,rmax2,dz) - create G4Polyhedron for G4 Cone; |
---|
| 58 | // G4PolyhedronCons(rmin1,rmax1, |
---|
| 59 | // rmin2,rmax2,dz, |
---|
| 60 | // phi1,dphi) - create G4Polyhedron for G4 Cons; |
---|
| 61 | // |
---|
| 62 | // G4PolyhedronPgon(phi,dphi,npdv,nz, |
---|
| 63 | // z(*),rmin(*),rmax(*)) - create G4Polyhedron for G4 Pgon; |
---|
| 64 | // G4PolyhedronPcon(phi,dphi,nz, |
---|
| 65 | // z(*),rmin(*),rmax(*)) - create G4Polyhedron for G4 Pcon; |
---|
| 66 | // |
---|
| 67 | // G4PolyhedronSphere(rmin,rmax, |
---|
| 68 | // phi,dphi,the,dthe) - create G4Polyhedron for Sphere; |
---|
| 69 | // G4PolyhedronTorus(rmin,rmax,rtor, |
---|
| 70 | // phi,dphi) - create G4Polyhedron for Torus; |
---|
| 71 | // G4PolyhedronEllipsoid(dx,dy,dz, |
---|
| 72 | // zcut1,zcut2) - create G4Polyhedron for Ellipsoid; |
---|
| 73 | // |
---|
| 74 | // Public functions inherited from HepPolyhedron (this list might be |
---|
| 75 | // incomplete): |
---|
| 76 | // GetNoVertices() - returns number of vertices |
---|
| 77 | // GetNoFacets() - returns number of faces |
---|
| 78 | // GetNextVertexIndex(index, edgeFlag) - get vertex indeces of the |
---|
| 79 | // quadrilaterals in order; returns false when |
---|
| 80 | // finished each face; |
---|
| 81 | // GetVertex(index) - returns vertex by index; |
---|
| 82 | // GetNextVertex(vertex, edgeFlag) - get vertices with edge visibility |
---|
| 83 | // of the quadrilaterals in order; |
---|
| 84 | // returns false when finished each face; |
---|
| 85 | // GetNextVertex(vertex, edgeFlag, normal) - get vertices with edge |
---|
| 86 | // visibility and normal of the quadrilaterals |
---|
| 87 | // in order; returns false when finished each face; |
---|
| 88 | // GetNextNormal(normal) - get normals of each face in order; |
---|
| 89 | // returns false when finished all faces; |
---|
| 90 | // GetNextUnitNormal(normal) - get normals of unit length of each face |
---|
| 91 | // in order; returns false when finished all faces; |
---|
| 92 | // GetNextEdgeIndeces(i1, i2, edgeFlag) - get indeces of the next edge; |
---|
| 93 | // returns false for the last edge; |
---|
| 94 | // GetNextEdge(p1, p2, edgeFlag) - get next edge; |
---|
| 95 | // returns false for the last edge; |
---|
| 96 | // SetNumberOfRotationSteps(G4int n) - Set number of steps for whole circle; |
---|
| 97 | |
---|
| 98 | // History: |
---|
| 99 | // 21st February 2000 Evgeni Chernaev, John Allison |
---|
| 100 | // - Re-written to inherit HepPolyhedron. |
---|
| 101 | // |
---|
| 102 | // 11.03.05 J.Allison |
---|
| 103 | // - Added fNumberOfRotationStepsAtTimeOfCreation and access method. |
---|
| 104 | // (NumberOfRotationSteps is also called number of sides per circle or |
---|
| 105 | // line segments per circle - see |
---|
| 106 | // /vis/viewer/set/lineSegmentsPerCircle.) |
---|
| 107 | // 20.06.05 G.Cosmo |
---|
| 108 | // - Added G4PolyhedronEllipsoid. |
---|
| 109 | // 09.03.06 J.Allison |
---|
| 110 | // - Added operator<<. |
---|
| 111 | |
---|
| 112 | #include "globals.hh" |
---|
| 113 | #include "HepPolyhedron.h" |
---|
| 114 | #include "G4Visible.hh" |
---|
| 115 | |
---|
| 116 | class G4Polyhedron : public HepPolyhedron, public G4Visible { |
---|
| 117 | public: |
---|
| 118 | G4Polyhedron (); |
---|
| 119 | G4Polyhedron (const HepPolyhedron& from); |
---|
| 120 | // Use compiler defaults for copy contructor and assignment. (They |
---|
| 121 | // invoke their counterparts in HepPolyhedron and G4Visible.) |
---|
| 122 | virtual ~G4Polyhedron (); |
---|
| 123 | |
---|
| 124 | G4int GetNumberOfRotationStepsAtTimeOfCreation() const { |
---|
| 125 | return fNumberOfRotationStepsAtTimeOfCreation; |
---|
| 126 | } |
---|
| 127 | private: |
---|
| 128 | G4int fNumberOfRotationStepsAtTimeOfCreation; |
---|
| 129 | }; |
---|
| 130 | |
---|
| 131 | class G4PolyhedronBox: public G4Polyhedron { |
---|
| 132 | public: |
---|
| 133 | G4PolyhedronBox (G4double dx, G4double dy, G4double dz); |
---|
| 134 | virtual ~G4PolyhedronBox (); |
---|
| 135 | }; |
---|
| 136 | |
---|
| 137 | class G4PolyhedronCone: public G4Polyhedron { |
---|
| 138 | public: |
---|
| 139 | G4PolyhedronCone (G4double Rmn1, G4double Rmx1, |
---|
| 140 | G4double Rmn2, G4double Rmx2, G4double Dz); |
---|
| 141 | virtual ~G4PolyhedronCone (); |
---|
| 142 | }; |
---|
| 143 | |
---|
| 144 | class G4PolyhedronCons: public G4Polyhedron { |
---|
| 145 | public: |
---|
| 146 | G4PolyhedronCons (G4double Rmn1, G4double Rmx1, |
---|
| 147 | G4double Rmn2, G4double Rmx2, G4double Dz, |
---|
| 148 | G4double Phi1, G4double Dphi); |
---|
| 149 | virtual ~G4PolyhedronCons (); |
---|
| 150 | }; |
---|
| 151 | |
---|
| 152 | class G4PolyhedronPara: public G4Polyhedron { |
---|
| 153 | public: |
---|
| 154 | G4PolyhedronPara (G4double Dx, G4double Dy, G4double Dz, |
---|
| 155 | G4double Alpha, G4double Theta, G4double Phi); |
---|
| 156 | virtual ~G4PolyhedronPara (); |
---|
| 157 | }; |
---|
| 158 | |
---|
| 159 | class G4PolyhedronPcon: public G4Polyhedron { |
---|
| 160 | public: |
---|
| 161 | G4PolyhedronPcon (G4double phi, G4double dphi, G4int nz, |
---|
| 162 | const G4double *z, |
---|
| 163 | const G4double *rmin, |
---|
| 164 | const G4double *rmax); |
---|
| 165 | virtual ~G4PolyhedronPcon (); |
---|
| 166 | }; |
---|
| 167 | |
---|
| 168 | class G4PolyhedronPgon: public G4Polyhedron { |
---|
| 169 | public: |
---|
| 170 | G4PolyhedronPgon (G4double phi, G4double dphi, G4int npdv, G4int nz, |
---|
| 171 | const G4double *z, |
---|
| 172 | const G4double *rmin, |
---|
| 173 | const G4double *rmax); |
---|
| 174 | virtual ~G4PolyhedronPgon (); |
---|
| 175 | }; |
---|
| 176 | |
---|
| 177 | class G4PolyhedronSphere: public G4Polyhedron { |
---|
| 178 | public: |
---|
| 179 | G4PolyhedronSphere (G4double rmin, G4double rmax, |
---|
| 180 | G4double phi, G4double dphi, |
---|
| 181 | G4double the, G4double dthe); |
---|
| 182 | virtual ~G4PolyhedronSphere (); |
---|
| 183 | }; |
---|
| 184 | |
---|
| 185 | class G4PolyhedronTorus: public G4Polyhedron { |
---|
| 186 | public: |
---|
| 187 | G4PolyhedronTorus (G4double rmin, G4double rmax, G4double rtor, |
---|
| 188 | G4double phi, G4double dphi); |
---|
| 189 | virtual ~G4PolyhedronTorus (); |
---|
| 190 | }; |
---|
| 191 | |
---|
| 192 | class G4PolyhedronTrap: public G4Polyhedron { |
---|
| 193 | public: |
---|
| 194 | G4PolyhedronTrap (G4double Dz, G4double Theta, G4double Phi, |
---|
| 195 | G4double Dy1, |
---|
| 196 | G4double Dx1, G4double Dx2, G4double Alp1, |
---|
| 197 | G4double Dy2, |
---|
| 198 | G4double Dx3, G4double Dx4, G4double Alp2); |
---|
| 199 | virtual ~G4PolyhedronTrap (); |
---|
| 200 | }; |
---|
| 201 | |
---|
| 202 | class G4PolyhedronTrd1: public G4Polyhedron { |
---|
| 203 | public: |
---|
| 204 | G4PolyhedronTrd1 (G4double Dx1, G4double Dx2, |
---|
| 205 | G4double Dy, G4double Dz); |
---|
| 206 | virtual ~G4PolyhedronTrd1 (); |
---|
| 207 | }; |
---|
| 208 | |
---|
| 209 | class G4PolyhedronTrd2: public G4Polyhedron { |
---|
| 210 | public: |
---|
| 211 | G4PolyhedronTrd2 (G4double Dx1, G4double Dx2, |
---|
| 212 | G4double Dy1, G4double Dy2, G4double Dz); |
---|
| 213 | virtual ~G4PolyhedronTrd2 (); |
---|
| 214 | }; |
---|
| 215 | |
---|
| 216 | class G4PolyhedronTube: public G4Polyhedron { |
---|
| 217 | public: |
---|
| 218 | G4PolyhedronTube (G4double Rmin, G4double Rmax, G4double Dz); |
---|
| 219 | virtual ~G4PolyhedronTube (); |
---|
| 220 | }; |
---|
| 221 | |
---|
| 222 | class G4PolyhedronTubs: public G4Polyhedron { |
---|
| 223 | public: |
---|
| 224 | G4PolyhedronTubs (G4double Rmin, G4double Rmax, G4double Dz, |
---|
| 225 | G4double Phi1, G4double Dphi); |
---|
| 226 | virtual ~G4PolyhedronTubs (); |
---|
| 227 | }; |
---|
| 228 | |
---|
| 229 | class G4PolyhedronParaboloid: public G4Polyhedron { |
---|
| 230 | public: |
---|
| 231 | G4PolyhedronParaboloid(G4double r1, G4double r2, G4double dz, |
---|
| 232 | G4double sPhi, G4double dPhi); |
---|
| 233 | virtual ~G4PolyhedronParaboloid (); |
---|
| 234 | }; |
---|
| 235 | |
---|
| 236 | class G4PolyhedronHype: public G4Polyhedron { |
---|
| 237 | public: |
---|
| 238 | G4PolyhedronHype(G4double r1, G4double r2, G4double tan1, |
---|
| 239 | G4double tan2, G4double halfZ); |
---|
| 240 | virtual ~G4PolyhedronHype (); |
---|
| 241 | }; |
---|
| 242 | |
---|
| 243 | class G4PolyhedronEllipsoid : public G4Polyhedron { |
---|
| 244 | public: |
---|
| 245 | G4PolyhedronEllipsoid(G4double dx, G4double dy, G4double dz, |
---|
| 246 | G4double zcut1, G4double zcut2); |
---|
| 247 | virtual ~G4PolyhedronEllipsoid (); |
---|
| 248 | }; |
---|
| 249 | |
---|
| 250 | class G4PolyhedronEllipticalCone : public G4Polyhedron { |
---|
| 251 | public: |
---|
| 252 | G4PolyhedronEllipticalCone(G4double dx, G4double dy, G4double z, |
---|
| 253 | G4double zcut1); |
---|
| 254 | virtual ~G4PolyhedronEllipticalCone (); |
---|
| 255 | }; |
---|
| 256 | |
---|
| 257 | std::ostream& operator<<(std::ostream& os, const G4Polyhedron&); |
---|
| 258 | |
---|
| 259 | #endif /* G4POLYHEDRON_HH */ |
---|