[233] | 1 | // this : |
---|
| 2 | #include <G4Lab/Polyhedron.h> |
---|
| 3 | |
---|
| 4 | // Lib : |
---|
| 5 | #include <Lib/Debug.h> |
---|
| 6 | |
---|
| 7 | #ifdef WIN32 |
---|
| 8 | #undef pascal // Clash between windef.h and Geant4/SystemOfnits.hh |
---|
| 9 | #endif |
---|
| 10 | |
---|
| 11 | // Geant4 : |
---|
| 12 | #include <G4Polyhedron.hh> |
---|
| 13 | |
---|
| 14 | namespace G4Lab { |
---|
| 15 | |
---|
| 16 | // To have access to G4Polyhedron::pF : |
---|
| 17 | class G4_Polyhedron : public G4Polyhedron { |
---|
| 18 | public: |
---|
| 19 | G4_Polyhedron(const G4Polyhedron& aFrom):G4Polyhedron(aFrom){ |
---|
| 20 | Lib::Debug::increment("G4_Polyhedron"); |
---|
| 21 | } |
---|
| 22 | virtual ~G4_Polyhedron() { |
---|
| 23 | Lib::Debug::decrement("G4_Polyhedron"); |
---|
| 24 | } |
---|
| 25 | G4Facet& getFacet(int aIndex) const {return pF[aIndex];} |
---|
| 26 | virtual G4_Polyhedron& operator=(const G4_Polyhedron& aFrom) { |
---|
| 27 | G4Polyhedron::operator=(aFrom); |
---|
| 28 | return *this; |
---|
| 29 | } |
---|
| 30 | }; |
---|
| 31 | |
---|
| 32 | } |
---|
| 33 | |
---|
| 34 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 35 | G4Lab::Polyhedron::Polyhedron( |
---|
| 36 | const G4Polyhedron& aFrom |
---|
| 37 | ) |
---|
| 38 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 39 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 40 | { |
---|
| 41 | Lib::Debug::increment("G4Lab::Polyhedron"); |
---|
| 42 | G4_Polyhedron g4Pol(aFrom); |
---|
| 43 | if (g4Pol.GetNoVertices() > 0 && g4Pol.GetNoFacets() > 0) { |
---|
| 44 | nvert = g4Pol.GetNoVertices(); |
---|
| 45 | nface = g4Pol.GetNoFacets(); |
---|
| 46 | pV = new HVPoint3D[nvert + 1]; |
---|
| 47 | pF = new SbFacet[nface + 1]; |
---|
| 48 | int i; |
---|
| 49 | for (i=1; i<=nvert; i++) { |
---|
| 50 | HepGeom::Point3D<double> p = g4Pol.GetVertex(i); |
---|
| 51 | pV[i].setValue((float)p.x(),(float)p.y(),(float)p.z()); |
---|
| 52 | } |
---|
| 53 | for (i=1; i<=nface; i++) { |
---|
| 54 | // Below is dangerous. |
---|
| 55 | pF[i] = (SbFacet&)g4Pol.getFacet(i); |
---|
| 56 | } |
---|
| 57 | }else{ |
---|
| 58 | nvert = 0; nface = 0; pV = 0; pF = 0; |
---|
| 59 | } |
---|
| 60 | } |
---|
| 61 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 62 | G4Lab::Polyhedron::~Polyhedron( |
---|
| 63 | ) |
---|
| 64 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 65 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 66 | { |
---|
| 67 | Lib::Debug::decrement("G4Lab::Polyhedron"); |
---|
| 68 | } |
---|
| 69 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 70 | G4Lab::Polyhedron& G4Lab::Polyhedron::operator=( |
---|
| 71 | const Polyhedron& aFrom |
---|
| 72 | ) |
---|
| 73 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 74 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 75 | { |
---|
| 76 | SbPolyhedron::operator=(aFrom); |
---|
| 77 | return *this; |
---|
| 78 | } |
---|
| 79 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 80 | SbPolyhedron & G4Lab::Polyhedron::operator=( |
---|
| 81 | const SbPolyhedron& aFrom |
---|
| 82 | ) |
---|
| 83 | ////////////////////////////////////////////////////////////////////////////// |
---|
| 84 | //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!// |
---|
| 85 | { |
---|
| 86 | return SbPolyhedron::operator=(aFrom); |
---|
| 87 | } |
---|