Geant4  10.01.p01
G4UExtrudedSolid.cc
Go to the documentation of this file.
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 //
27 // $Id:$
28 //
29 //
30 // Implementation of G4UExtrudedSolid wrapper class
31 // --------------------------------------------------------------------
32 
33 #include "G4ExtrudedSolid.hh"
34 #include "G4UExtrudedSolid.hh"
35 #include "G4Polyhedron.hh"
36 
38 //
39 // Constructors
40 //
42  std::vector<G4TwoVector> polygon,
43  std::vector<ZSection> zsections)
44  : G4USolid(name, new UExtrudedSolid())
45 {
46  GetShape()->SetName(name);
47  std::vector<UVector2> pvec;
48  for (unsigned int i=0; i<polygon.size(); ++i)
49  {
50  pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
51  }
52  std::vector<UExtrudedSolid::ZSection> svec;
53  for (unsigned int i=0; i<zsections.size(); ++i)
54  {
55  ZSection sec = zsections[i];
56  svec.push_back(UExtrudedSolid::ZSection(sec.fZ,
57  UVector2(sec.fOffset.x(), sec.fOffset.y()), sec.fScale));
58  }
59  GetShape()->Initialise(pvec, svec);
60 }
61 
62 
64  std::vector<G4TwoVector> polygon,
65  G4double halfZ,
66  G4TwoVector off1, G4double scale1,
67  G4TwoVector off2, G4double scale2)
68  : G4USolid(name, new UExtrudedSolid())
69 {
70  GetShape()->SetName(name);
71  std::vector<UVector2> pvec;
72  for (unsigned int i=0; i<polygon.size(); ++i)
73  {
74  pvec.push_back(UVector2(polygon[i].x(), polygon[i].y()));
75  }
76  GetShape()->Initialise(pvec, halfZ, UVector2(off1.x(), off1.y()), scale1,
77  UVector2(off2.x(), off2.y()), scale2);
78 }
79 
81 //
82 // Fake default constructor - sets only member data and allocates memory
83 // for usage restricted to object persistency.
84 //
86  : G4USolid(a)
87 {
88 }
89 
90 
92 //
93 // Destructor
94 //
96 {
97 }
98 
99 
101 //
102 // Copy constructor
103 //
105  : G4USolid(source)
106 {
107 }
108 
109 
111 //
112 // Assignment operator
113 //
116 {
117  if (this == &source) return *this;
118 
119  G4USolid::operator=( source );
120 
121  return *this;
122 }
void Initialise(std::vector< UVector2 > &polygon, std::vector< ZSection > &zsections)
G4String name
Definition: TRTMaterials.hh:40
G4double a
Definition: TRTMaterials.hh:39
void SetName(const std::string &aName)
Definition: VUSolid.hh:104
UExtrudedSolid * GetShape() const
G4UExtrudedSolid(const G4String &pName, std::vector< G4TwoVector > polygon, std::vector< ZSection > zsections)
G4UExtrudedSolid & operator=(const G4UExtrudedSolid &source)
G4USolid & operator=(const G4USolid &rhs)
Definition: G4USolid.cc:372
CLHEP::Hep2Vector G4TwoVector
Definition: G4TwoVector.hh:42
double G4double
Definition: G4Types.hh:76