74 fLowerEndcap(0), fUpperEndcap(0), fSide0(0),
75 fSide90(0), fSide180(0), fSide270(0)
97 fDx = ( fDxUp > fDxDown ? fDxUp : fDxDown ) ;
108 message <<
"Not planar surface in untwisted Trapezoid: "
110 <<
"fDy2 is " <<
fDy2 <<
" but should be "
112 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
128 message <<
"Not planar surface in untwisted Trapezoid: "
130 <<
"One endcap is rectangular, the other is a trapezoid." <<
G4endl
131 <<
"For planarity reasons they have to be rectangles or trapezoids "
133 G4Exception(
"G4VTwistedFaceted::G4VTwistedFaceted()",
"GeomSolids0002",
164 && ( std::fabs(
fPhiTwist) > 2*kAngTolerance )
167 && ( fTheta < pi/2 && fTheta >= 0 ) )
171 message <<
"Invalid dimensions. Too small, or twist angle too big: "
193 fTheta(0.), fPhi(0.), fDy1(0.),
194 fDx1(0.), fDx2(0.), fDy2(0.), fDx3(0.), fDx4(0.),
195 fDz(0.), fDx(0.), fDy(0.), fAlph(0.),
196 fTAlph(0.), fdeltaX(0.), fdeltaY(0.), fPhiTwist(0.),
197 fLowerEndcap(0), fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0),
224 fTheta(rhs.fTheta), fPhi(rhs.fPhi),
225 fDy1(rhs.fDy1), fDx1(rhs.fDx1), fDx2(rhs.fDx2), fDy2(rhs.fDy2),
226 fDx3(rhs.fDx3), fDx4(rhs.fDx4), fDz(rhs.fDz), fDx(rhs.fDx), fDy(rhs.fDy),
227 fAlph(rhs.fAlph), fTAlph(rhs.fTAlph), fdeltaX(rhs.fdeltaX),
228 fdeltaY(rhs.fdeltaY), fPhiTwist(rhs.fPhiTwist), fLowerEndcap(0),
229 fUpperEndcap(0), fSide0(0), fSide90(0), fSide180(0), fSide270(0),
230 fCubicVolume(rhs.fCubicVolume), fSurfaceArea(rhs.fSurfaceArea),
231 fLastInside(rhs.fLastInside), fLastNormal(rhs.fLastNormal),
232 fLastDistanceToIn(rhs.fLastDistanceToIn),
233 fLastDistanceToOut(rhs.fLastDistanceToOut),
234 fLastDistanceToInWithV(rhs.fLastDistanceToInWithV),
235 fLastDistanceToOutWithV(rhs.fLastDistanceToOutWithV)
248 if (
this == &rhs) {
return *
this; }
284 G4Exception(
"G4VTwistedFaceted::ComputeDimensions()",
286 "G4VTwistedFaceted does not support Parameterisation.");
297 pMin.
set(-maxRad,-maxRad,-
fDz);
298 pMax.
set( maxRad, maxRad,
fDz);
339 tmpp->
set(p.
x(), p.
y(), p.
z());
352 G4double posx = px * cphi - py * sphi ;
353 G4double posy = px * sphi + py * cphi ;
445 tmpp->
set(p.
x(), p.
y(), p.
z());
465 if (tmpdistance < distance)
467 distance = tmpdistance;
473 tmpsurface[0] = surfaces[besti];
474 *tmpnormal = tmpsurface[0]->
GetNormal(bestxx,
true);
509 tmpp->
set(p.
x(), p.
y(), p.
z());
510 tmpv->
set(v.
x(), v.
y(), v.
z());
554 for (
auto i=0; i < 6 ; ++i)
561 G4cout <<
"Solid DistanceToIn : distance = " << tmpdistance <<
G4endl ;
564 if (tmpdistance < distance)
566 distance = tmpdistance;
605 tmpp->
set(p.
x(), p.
y(), p.
z());
645 for (
auto i=0; i< 6; ++i)
648 if (tmpdistance < distance)
650 distance = tmpdistance;
660 G4Exception(
"G4VTwistedFaceted::DistanceToIn(p)",
"GeomSolids0003",
701 tmpp->
set(p.
x(), p.
y(), p.
z());
702 tmpv->
set(v.
x(), v.
y(), v.
z());
725 *norm = (blockedsurface->
GetNormal(p,
true));
752 for (
auto i=0; i<6 ; ++i)
755 if (tmpdistance < distance)
757 distance = tmpdistance;
767 *norm = (surfaces[besti]->
GetNormal(p,
true));
801 tmpp->
set(p.
x(), p.
y(), p.
z());
823 G4cout.precision(oldprc) ;
824 G4Exception(
"G4VTwistedFaceted::DistanceToOut(p)",
"GeomSolids1002",
855 for (
auto i=0; i<6; ++i)
858 if (tmpdistance < distance)
860 distance = tmpdistance;
872 G4Exception(
"G4VTwistedFaceted::DistanceToOut(p)",
"GeomSolids0003",
890 G4int oldprc = os.precision(16);
891 os <<
"-----------------------------------------------------------\n"
892 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
893 <<
" ===================================================\n"
894 <<
" Solid type: G4VTwistedFaceted\n"
900 <<
" Half length along y (lower endcap) = " <<
fDy1/
cm <<
" cm"
902 <<
" Half length along x (lower endcap, bottom) = " <<
fDx1/
cm <<
" cm"
904 <<
" Half length along x (lower endcap, top) = " <<
fDx2/
cm <<
" cm"
906 <<
" Half length along y (upper endcap) = " <<
fDy2/
cm <<
" cm"
908 <<
" Half length along x (upper endcap, bottom) = " <<
fDx3/
cm <<
" cm"
910 <<
" Half length along x (upper endcap, top) = " <<
fDx4/
cm <<
" cm"
912 <<
"-----------------------------------------------------------\n";
913 os.precision(oldprc);
995 return G4String(
"G4VTwistedFaceted");
1030 if ( z ==
fDz ) z -= 0.1*
fDz ;
1031 if ( z == -
fDz ) z += 0.1*
fDz ;
1081 else if( (chose >= a1) && (chose < a1 + a2 ) )
1090 else if( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) )
1098 else if( (chose >= a1 + a2 + a3 ) && (chose < a1 + a2 + a3 + a4 ) )
1105 else if( (chose >= a1 + a2 + a3 + a4 ) && (chose < a1 + a2 + a3 + a4 + a5 ) )
1138 const G4int nnodes = 4*(k-1)*(n-2) + 2*k*
k ;
1139 const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
1143 typedef G4int G4int4[4];
1144 G4double3* xyz =
new G4double3[nnodes];
1145 G4int4* faces =
new G4int4[nfaces] ;