55 fTAlph = std::tan(fAlpha) ;
59 fdeltaX = 2 * fDz * std::tan(fTheta) * std::cos(fPhi) ;
61 fdeltaY = 2 * fDz * std::tan(fTheta) * std::sin(fPhi) ;
64 fPhiTwist = PhiTwist ;
140 for (
auto i=0; i<2; ++i)
142 distance[i] = kInfinity;
145 gxx[i].
set(kInfinity, kInfinity, kInfinity);
156 if (std::fabs(p.
z()) == 0.)
164 areacode[0] = GetAreaCode(xx);
172 areacode[0] = GetAreaCode(xx,
false);
191 fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
192 isvalid[0], 0, validate, &gp, &gv);
196 distance[0] = - (p.
z() / v.
z());
203 areacode[0] = GetAreaCode(xx);
206 if (distance[0] >= 0) { isvalid[0] =
true; }
211 areacode[0] = GetAreaCode(xx,
false);
214 if (distance[0] >= 0) { isvalid[0] =
true; }
220 if (distance[0] >= 0) { isvalid[0] =
true; }
223 fCurStatWithV.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
224 isvalid[0], 1, validate, &gp, &gv);
227 G4cerr <<
"ERROR - G4TwistTrapFlatSide::DistanceToSurface(p,v)" <<
G4endl;
257 distance[i] =
fCurStat.GetDistance(i);
258 areacode[i] =
fCurStat.GetAreacode(i);
264 for (
auto i=0; i<2; ++i)
266 distance[i] = kInfinity;
268 gxx[i].
set(kInfinity, kInfinity, kInfinity);
283 distance[0] = std::fabs(p.
z());
284 xx.
set(p.
x(), p.
y(), 0);
290 fCurStat.SetCurrentStatus(0, gxx[0], distance[0], areacode[0],
310 G4double wmax = xAxisMax(xx.
y(), fTAlph ) ;
311 G4double wmin = -xAxisMax(xx.
y(), -fTAlph ) ;
319 if (xx.
x() < wmin + ctol)
322 if (xx.
x() <= wmin - ctol) { isoutside =
true; }
324 else if (xx.
x() > wmax - ctol)
327 if (xx.
x() >= wmax + ctol) { isoutside =
true; }
344 if (xx.
y() <=
fAxisMin[yaxis] - ctol) { isoutside =
true; }
346 else if (xx.
y() >
fAxisMax[yaxis] - ctol)
358 if (xx.
y() >=
fAxisMax[yaxis] + ctol) { isoutside =
true; }
367 areacode = tmpareacode;
382 else if (xx.
x() > wmax)
424 "Feature NOT implemented !");
432void G4TwistTrapFlatSide::SetCorners()
441 x = -fDx1 + fDy * fTAlph ;
447 x = fDx1 + fDy * fTAlph ;
453 x = fDx2 - fDy * fTAlph ;
459 x = -fDx2 - fDy * fTAlph ;
467 std::ostringstream message;
468 message <<
"Feature NOT implemented !" <<
G4endl
470 <<
" fAxis[1] = " <<
fAxis[1];
479void G4TwistTrapFlatSide::SetBoundaries()
490 direction = direction.
unit();
496 direction = direction.
unit();
502 direction = direction.
unit();
508 direction = direction.
unit();
515 std::ostringstream message;
516 message <<
"Feature NOT implemented !" <<
G4endl
518 <<
" fAxis[1] = " <<
fAxis[1];
540 for (
G4int i = 0 ; i<
n ; ++i )
542 y = -fDy + i*(2*fDy)/(n-1) ;
544 for (
G4int j = 0 ; j<k ; ++j )
546 xmin = GetBoundaryMin(y) ;
547 xmax = GetBoundaryMax(y) ;
548 x = xmin + j*(xmax-xmin)/(k-1) ;
550 nnode =
GetNode(i,j,k,n,iside) ;
551 p = SurfacePoint(x,y,
true) ;
553 xyz[nnode][0] = p.
x() ;
554 xyz[nnode][1] = p.
y() ;
555 xyz[nnode][2] = p.
z() ;
557 if ( i<n-1 && j<k-1 )
559 nface =
GetFace(i,j,k,n,iside) ;
564 * (
GetNode(i ,j ,k,n,iside)+1) ;
566 * (
GetNode(i+1,j ,k,n,iside)+1) ;
568 * (
GetNode(i+1,j+1,k,n,iside)+1) ;
570 * (
GetNode(i ,j+1,k,n,iside)+1) ;
575 * (
GetNode(i ,j ,k,n,iside)+1) ;
577 * (
GetNode(i ,j+1,k,n,iside)+1) ;
579 * (
GetNode(i+1,j+1,k,n,iside)+1) ;
581 * (
GetNode(i+1,j ,k,n,iside)+1) ;
const G4double kCarTolerance
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
CLHEP::Hep3Vector G4ThreeVector
G4GLOB_DLL std::ostream G4cerr
void set(double x, double y, double z)
G4ThreeVector GetNormal(const G4ThreeVector &, G4bool isGlobal=false) override
G4TwistTrapFlatSide(const G4String &name, G4double PhiTwist, G4double pDx1, G4double pDx2, G4double pDy, G4double pDz, G4double pAlpha, G4double pPhi, G4double pTheta, G4int handedness)
G4int DistanceToSurface(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector gxx[], G4double distance[], G4int areacode[], G4bool isvalid[], EValidate validate=kValidateWithTol) override
static const G4int sC0Min1Min
static const G4int sC0Min1Max
G4VTwistSurface(const G4String &name)
G4int GetNode(G4int i, G4int j, G4int m, G4int n, G4int iside)
static const G4int sOutside
G4ThreeVector ComputeGlobalDirection(const G4ThreeVector &lp) const
static const G4int sAxisMax
static const G4int sAxis0
G4int GetFace(G4int i, G4int j, G4int m, G4int n, G4int iside)
const G4String & GetName() const
G4int GetEdgeVisibility(G4int i, G4int j, G4int m, G4int n, G4int number, G4int orientation)
G4ThreeVector ComputeLocalDirection(const G4ThreeVector &gp) const
static const G4int sAxisMin
static const G4int sC0Max1Max
static const G4int sAxis1
G4bool IsInside(G4int areacode, G4bool testbitmode=false) const
virtual void SetBoundary(const G4int &axiscode, const G4ThreeVector &direction, const G4ThreeVector &x0, const G4int &boundarytype)
G4ThreeVector ComputeLocalPoint(const G4ThreeVector &gp) const
void SetCorner(G4int areacode, G4double x, G4double y, G4double z)
G4ThreeVector GetCorner(G4int areacode) const
static const G4int sBoundary
G4bool IsOutside(G4int areacode) const
static const G4int sCorner
static const G4int sC0Max1Min
static const G4int sInside
CurrentStatus fCurStatWithV
static const G4int sAxisY
static const G4int sAxisX
G4ThreeVector ComputeGlobalPoint(const G4ThreeVector &lp) const
G4SurfCurNormal fCurrentNormal