83 :
G4VSolid(pname), fRebuildPolyhedron(false), fpPolyhedron(0),
84 fLowerEndcap(0), fUpperEndcap(0), fSide0(0),
85 fSide90(0), fSide180(0), fSide270(0),
108 fDx = ( fDxUp > fDxDown ? fDxUp : fDxDown ) ;
118 std::ostringstream message;
119 message <<
"Not planar surface in untwisted Trapezoid: "
121 <<
"fDy2 is " <<
fDy2 <<
" but should be "
123 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
138 std::ostringstream message;
139 message <<
"Not planar surface in untwisted Trapezoid: "
141 <<
"One endcap is rectangular, the other is a trapezoid." <<
G4endl
142 <<
"For planarity reasons they have to be rectangles or trapezoids "
144 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
175 && ( std::fabs(
fPhiTwist) > 2*kAngTolerance )
178 && ( fTheta < pi/2 && fTheta >= 0 ) )
181 std::ostringstream message;
182 message <<
"Invalid dimensions. Too small, or twist angle too big: "
203 :
G4VSolid(a), fRebuildPolyhedron(false), fpPolyhedron(0),
204 fTheta(0.), fPhi(0.), fDy1(0.),
205 fDx1(0.), fDx2(0.), fDy2(0.), fDx3(0.), fDx4(0.),
206 fDz(0.), fDx(0.), fDy(0.), fAlph(0.),
207 fTAlph(0.), fdeltaX(0.), fdeltaY(0.), fPhiTwist(0.),
208 fLowerEndcap(0), fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0),
209 fSide270(0), fCubicVolume(0.), fSurfaceArea(0.)
232 :
G4VSolid(rhs), fRebuildPolyhedron(false), fpPolyhedron(0),
233 fTheta(rhs.fTheta), fPhi(rhs.fPhi),
234 fDy1(rhs.fDy1), fDx1(rhs.fDx1), fDx2(rhs.fDx2), fDy2(rhs.fDy2),
235 fDx3(rhs.fDx3), fDx4(rhs.fDx4), fDz(rhs.fDz), fDx(rhs.fDx), fDy(rhs.fDy),
236 fAlph(rhs.fAlph), fTAlph(rhs.fTAlph), fdeltaX(rhs.fdeltaX),
237 fdeltaY(rhs.fdeltaY), fPhiTwist(rhs.fPhiTwist), fLowerEndcap(0),
238 fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0), fSide270(0),
239 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
240 fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
241 fLastDistanceToIn(rhs.fLastDistanceToIn),
242 fLastDistanceToOut(rhs.fLastDistanceToOut),
243 fLastDistanceToInWithV(rhs.fLastDistanceToInWithV),
244 fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV)
257 if (
this == &rhs) {
return *
this; }
292 G4Exception(
"G4VTwistedFaceted::ComputeDimensions()",
294 "G4VTwistedFaceted does not support Parameterisation.");
320 xMin = xoffset - maxRad ;
321 xMax = xoffset + maxRad ;
340 yMin = yoffset - maxRad ;
341 yMax = yoffset + maxRad ;
360 zMin = zoffset -
fDz ;
361 zMax = zoffset +
fDz ;
403 G4bool existsAfterClip = false ;
416 if (pVoxelLimit.
IsLimited(pAxis) ==
false)
420 existsAfterClip = true ;
437 existsAfterClip = true ;
473 existsAfterClip = true ;
479 return existsAfterClip;
493 vertices->reserve(8);
518 G4Exception(
"G4VTwistedFaceted::CreateRotatedVertices()",
520 "Error in allocation of vertices. Out of memory !");
538 tmpp->set(p.x(), p.y(), p.z());
551 G4double posx = px * cphi - py * sphi ;
552 G4double posy = px * sphi + py * cphi ;
642 tmpp->set(p.x(), p.y(), p.z());
662 if (tmpdistance < distance)
664 distance = tmpdistance;
670 tmpsurface[0] = surfaces[besti];
671 *tmpnormal = tmpsurface[0]->
GetNormal(bestxx,
true);
705 tmpp->set(p.x(), p.y(), p.z());
706 tmpv->set(v.x(), v.y(), v.z());
751 for (i=0; i < 6 ; i++)
758 G4cout <<
"Solid DistanceToIn : distance = " << tmpdistance <<
G4endl ;
761 if (tmpdistance < distance)
763 distance = tmpdistance;
799 tmpp->set(p.x(), p.y(), p.z());
843 if (tmpdistance < distance)
845 distance = tmpdistance;
855 G4Exception(
"G4VTwistedFaceted::DistanceToIn(p)",
"GeomSolids0003",
896 tmpp->set(p.x(), p.y(), p.z());
897 tmpv->set(v.x(), v.y(), v.z());
920 *norm = (blockedsurface->
GetNormal(p,
true));
948 for (i=0; i< 6 ; i++) {
950 if (tmpdistance < distance)
952 distance = tmpdistance;
962 *norm = (surfaces[besti]->
GetNormal(p,
true));
997 tmpp->set(p.x(), p.y(), p.z());
1007 switch (currentside)
1019 G4cout.precision(oldprc) ;
1020 G4Exception(
"G4VTwistedFaceted::DistanceToOut(p)",
"GeomSolids1002",
1052 for (i=0; i< 6; i++)
1055 if (tmpdistance < distance)
1057 distance = tmpdistance;
1061 *tmpdist = distance;
1069 G4Exception(
"G4VTwistedFaceted::DistanceToOut(p)",
"GeomSolids0003",
1087 G4int oldprc = os.precision(16);
1088 os <<
"-----------------------------------------------------------\n"
1089 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
1090 <<
" ===================================================\n"
1091 <<
" Solid type: G4VTwistedFaceted\n"
1092 <<
" Parameters: \n"
1097 <<
" Half length along y (lower endcap) = " <<
fDy1/
cm <<
" cm"
1099 <<
" Half length along x (lower endcap, bottom) = " <<
fDx1/
cm <<
" cm"
1101 <<
" Half length along x (lower endcap, top) = " <<
fDx2/
cm <<
" cm"
1103 <<
" Half length along y (upper endcap) = " <<
fDy2/
cm <<
" cm"
1105 <<
" Half length along x (upper endcap, bottom) = " <<
fDx3/
cm <<
" cm"
1107 <<
" Half length along x (upper endcap, top) = " <<
fDx4/
cm <<
" cm"
1109 <<
"-----------------------------------------------------------\n";
1110 os.precision(oldprc);
1191 return G4String(
"G4VTwistedFaceted");
1226 if ( z ==
fDz ) z -= 0.1*
fDz ;
1227 if ( z == -
fDz ) z += 0.1*
fDz ;
1278 else if( (chose >= a1) && (chose < a1 + a2 ) )
1289 else if( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1299 else if( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1309 else if( (chose >= a1 + a2 + a3 + a4 ) && (chose < a1 + a2 + a3 + a4 + a5 ) )
1339 G4int(G4Polyhedron::GetNumberOfRotationSteps() *
fPhiTwist / twopi) + 2;
1342 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*k ;
1343 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
1347 typedef G4int G4int4[4];
1348 G4double3* xyz =
new G4double3[nnodes];
1349 G4int4* faces =
new G4int4[nfaces] ;
1358 ph->createPolyhedron(nnodes,nfaces,xyz,faces);
LastValue fLastDistanceToOut
void ClipCrossSection(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
ThreeVector shoot(const G4int Ap, const G4int Af)
virtual void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *)
G4ThreeVectorList * CreateRotatedVertices(const G4AffineTransform &pTransform) const
G4VTwistSurface * fSide90
static const G4double kInfinity
G4double GetMinYExtent() const
G4VTwistedFaceted(const G4String &pname, G4double PhiTwist, G4double pDz, G4double pTheta, G4double pPhi, G4double pDy1, G4double pDx1, G4double pDx2, G4double pDy2, G4double pDx3, G4double pDx4, G4double pAlph)
G4VTwistSurface * fUpperEndcap
CLHEP::Hep3Vector G4ThreeVector
LastValueWithDoubleVector fLastDistanceToOutWithV
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal)=0
G4bool IsYLimited() const
G4bool fRebuildPolyhedron
virtual G4GeometryType GetEntityType() const
G4ThreeVector GetPointOnSurface() const
G4ThreeVector GetPointInSolid(G4double z) const
virtual G4Polyhedron * CreatePolyhedron() const
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4bool IsXLimited() const
G4VTwistedFaceted & operator=(const G4VTwistedFaceted &rhs)
virtual void AddSolid(const G4Box &)=0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
#define G4MUTEX_INITIALIZER
G4bool IsValidNorm() const
G4VTwistSurface * fSide180
LastValue fLastDistanceToIn
virtual G4double DistanceToIn(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
G4double Xcoef(G4double u, G4double phi, G4double ftg) const
static double normal(HepRandomEngine *eptr)
G4double GetMaxXExtent() const
virtual G4double GetSurfaceArea()=0
G4VTwistSurface * fSide270
G4double GetMinZExtent() const
G4GLOB_DLL std::ostream G4cout
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
void SetNeighbours(G4VTwistSurface *axis0min, G4VTwistSurface *axis1min, G4VTwistSurface *axis0max, G4VTwistSurface *axis1max)
virtual G4double DistanceTo(const G4ThreeVector &gp, G4ThreeVector &gxx)
virtual G4double DistanceToOut(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
virtual G4ThreeVector SurfacePoint(G4double, G4double, G4bool isGlobal=false)=0
virtual ~G4VTwistedFaceted()
G4double GetValueB(G4double phi) const
G4VTwistSurface * fLowerEndcap
std::vector< G4ThreeVector > G4ThreeVectorList
LastValueWithDoubleVector fLastDistanceToInWithV
virtual G4double GetBoundaryMax(G4double)=0
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)=0
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=false, G4bool *validnorm=0, G4ThreeVector *n=0) const
virtual G4double GetBoundaryMin(G4double)=0
G4double GetMinXExtent() const
G4double GetMaxZExtent() const
virtual G4Polyhedron * GetPolyhedron() const
G4VTwistSurface ** surface
virtual G4VisExtent GetExtent() const
virtual EInside Inside(const G4ThreeVector &p) const
virtual void DescribeYourselfTo(G4VGraphicsScene &scene) const
static const double degree
G4double GetMaxYExtent() const
G4VSolid & operator=(const G4VSolid &rhs)
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
virtual std::ostream & StreamInfo(std::ostream &os) const
G4double GetMaxExtent(const EAxis pAxis) const
G4bool IsZLimited() const
G4Polyhedron * fpPolyhedron
G4double GetAngularTolerance() const
void ClipBetweenSections(G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
G4double GetMinExtent(const EAxis pAxis) const
static G4GeometryTolerance * GetInstance()