36 #if defined(G4GEOM_USE_USOLIDS)
46 const std::vector<G4TwoVector>& vertices)
47 : G4USolid(name, new UGenericTrap())
49 SetZHalfLength(halfZ);
50 std::vector<UVector2> v;
51 for (
size_t n=0;
n<vertices.size(); ++
n)
53 v.push_back(UVector2(vertices[
n].
x(),vertices[
n].y()));
55 GetShape()->SetName(name);
56 GetShape()->Initialise(v);
65 G4UGenericTrap::G4UGenericTrap(__void__&
a)
75 G4UGenericTrap::~G4UGenericTrap()
84 G4UGenericTrap::G4UGenericTrap(
const G4UGenericTrap &source)
95 G4UGenericTrap::operator=(
const G4UGenericTrap &source)
97 if (
this == &source)
return *
this;
99 G4USolid::operator=( source );
114 size_t nVertices, nFacets;
117 G4int subdivisions=0;
121 if ( GetVisSubdivisions()!= 0 )
123 subdivisions=GetVisSubdivisions();
132 if(GetTwistAngle(i)>maxTwist) { maxTwist=GetTwistAngle(i); }
138 UVector3 minBox = GetShape()->GetMinimumBBox();
139 UVector3 maxBox = GetShape()->GetMaximumBBox();
142 Dx = 0.5*(maxVec.x()- minVec.y());
143 Dy = 0.5*(maxVec.y()- minVec.y());
144 if (Dy > Dx) { Dx=Dy; }
146 subdivisions=8*
G4int(maxTwist/(Dx*Dx*Dx)*fDz);
147 if (subdivisions<4) { subdivisions=4; }
148 if (subdivisions>30) { subdivisions=30; }
151 G4int sub4=4*subdivisions;
152 nVertices = 8+subdivisions*4;
153 nFacets = 6+subdivisions*4;
162 GetVertex(i).y(),-fDz));
164 for( i=0;i<subdivisions;i++)
166 for(
G4int j=0;j<4;j++)
168 G4TwoVector u=GetVertex(j)+cf*(i+1)*( GetVertex(j+4)-GetVertex(j));
175 GetVertex(i).y(),fDz));
181 for (i=0;i<subdivisions+1;i++)
184 polyhedron->
AddFacet(5+is,8+is,4+is,1+is);
185 polyhedron->
AddFacet(8+is,7+is,3+is,4+is);
186 polyhedron->
AddFacet(7+is,6+is,2+is,3+is);
187 polyhedron->
AddFacet(6+is,5+is,1+is,2+is);
189 polyhedron->
AddFacet(5+sub4,6+sub4,7+sub4,8+sub4);
197 #endif // G4GEOM_USE_USOLIDS
CLHEP::Hep3Vector G4ThreeVector
void AddVertex(const G4ThreeVector &v)
const G4double x[NPOINTSGL]
void AddFacet(const G4int iv1, const G4int iv2, const G4int iv3, const G4int iv4=0)
CLHEP::Hep2Vector G4TwoVector