79      fLowerEndcap(0), fUpperEndcap(0), fLatterTwisted(0),
    80      fFormerTwisted(0), fInnerHype(0), fOuterHype(0),
    81      fCubicVolume(0.), fSurfaceArea(0.),
    82      fRebuildPolyhedron(false), fpPolyhedron(0)
    86       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
    90    G4double sinhalftwist = std::sin(0.5 * twistedangle);
    92    G4double endinnerradX = endinnerrad * sinhalftwist;
    93    G4double innerrad     = std::sqrt( endinnerrad * endinnerrad
    94                                  - endinnerradX * endinnerradX );
    96    G4double endouterradX = endouterrad * sinhalftwist;
    97    G4double outerrad     = std::sqrt( endouterrad * endouterrad
    98                                  - endouterradX * endouterradX );
   101    SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
   121       std::ostringstream message;
   122       message << 
"Invalid number of segments." << 
G4endl   123               << 
"        nseg = " << nseg;
   124       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
   129       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
   133    G4double sinhalftwist = std::sin(0.5 * twistedangle);
   135    G4double endinnerradX = endinnerrad * sinhalftwist;
   136    G4double innerrad     = std::sqrt( endinnerrad * endinnerrad
   137                                  - endinnerradX * endinnerradX );
   139    G4double endouterradX = endouterrad * sinhalftwist;
   140    G4double outerrad     = std::sqrt( endouterrad * endouterrad
   141                                  - endouterradX * endouterradX );
   144    fDPhi = totphi / nseg;
   145    SetFields(twistedangle, innerrad, outerrad, -halfzlen, halfzlen);
   164       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
   168    SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
   188       std::ostringstream message;
   189       message << 
"Invalid number of segments." << 
G4endl   190               << 
"        nseg = " << nseg;
   191       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
   196       G4Exception(
"G4TwistedTubs::G4TwistedTubs()", 
"GeomSolids0002",
   200    fDPhi = totphi / nseg;
   201    SetFields(twistedangle, innerrad, outerrad, negativeEndz, positiveEndz);
   255   for (
size_t i=0; i<2; ++i)
   274    if (
this == &rhs)  { 
return *
this; }
   299    for (
size_t i=0; i<2; ++i)
   324               "G4TwistedTubs does not support Parameterisation.");
   352   G4double rFudge = 1.0/std::cos(0.5*sigPhi);
   353   G4double fudgeEndOuterRad = rFudge * maxEndOuterRad;
   401   if ( phimax > 
pi/2)  { phimax = 
pi-phimax; }
   417        G4ThreeVector(fudgeEndOuterRad*cosPhi, fudgeEndOuterRad*sinPhi, 
   420        G4ThreeVector(fudgeEndOuterRad*cosPhi, fudgeEndOuterRad*sinPhi, 
   425           G4ThreeVector(fudgeEndOuterRad*cosPhi, fudgeEndOuterRad*sinPhi, 0));
   468   cosPhi = std::cos(phimax);
   469   sinPhi = std::sin(phimax);
   474        G4ThreeVector(fudgeEndOuterRad*cosPhi, fudgeEndOuterRad*sinPhi,
   477        G4ThreeVector(fudgeEndOuterRad*cosPhi, fudgeEndOuterRad*sinPhi,
   563         phiPoly.
SetNormal( (v1-v0).cross(w0-v0).unit() );
   591       tmpp->
set(p.
x(), p.
y(), p.
z());
   598    if ((outerhypearea == 
kOutside) || (distanceToOut < -halftol))
   608       if (distanceToOut <= halftol)
   643    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());
   756       if (tmpdistance < distance)
   758          distance = tmpdistance;
   790       tmpp->
set(p.
x(), p.
y(), p.
z());
   828             if (tmpdistance < distance)
   830                distance = tmpdistance;
   839          G4Exception(
"G4TwistedTubs::DistanceToIn(p)", 
"GeomSolids0003",
   878       tmpp->
set(p.
x(), p.
y(), p.
z());
   879       tmpv->
set(v.
x(), v.
y(), v.
z());
   904            *norm = (blockedsurface->
GetNormal(p, 
true));
   936       if (tmpdistance < distance)
   938          distance = tmpdistance;
   948          *norm = (surfaces[besti]->
GetNormal(p, 
true));
   982       tmpp->
set(p.
x(), p.
y(), p.
z());
  1018          for (i=0; i< 6; i++)
  1021             if (tmpdistance < distance)
  1023                distance = tmpdistance;
  1027          *tmpdist = distance;
  1033          G4Exception(
"G4TwistedTubs::DistanceToOut(p)", 
"GeomSolids0003",
  1049   G4int oldprc = os.precision(16);
  1050   os << 
"-----------------------------------------------------------\n"  1051      << 
"    *** Dump for solid - " << 
GetName() << 
" ***\n"  1052      << 
"    ===================================================\n"  1053      << 
" Solid type: G4TwistedTubs\n"  1054      << 
" Parameters: \n"  1055      << 
"    -ve end Z              : " << 
fEndZ[0]/
mm << 
" mm \n"  1056      << 
"    +ve end Z              : " << 
fEndZ[1]/
mm << 
" mm \n"  1066      << 
"    phi-width of a piece   : " << 
fDPhi/
degree << 
" degrees \n"  1067      << 
"-----------------------------------------------------------\n";
  1068   os.precision(oldprc);
  1090   return G4VisExtent( -maxEndOuterRad, maxEndOuterRad, 
  1091                       -maxEndOuterRad, maxEndOuterRad, 
  1108   const G4int nnodes = 4*(k-1)*(n-2) + 2*k*k ;
  1109   const G4int nfaces = 4*(k-1)*(n-1) + 2*(k-1)*(k-1) ;
  1113   typedef G4int G4int4[4];
  1114   G4double3* xyz = 
new G4double3[nnodes];  
  1115   G4int4*  faces = 
new G4int4[nfaces] ;    
  1278   else if ( (chose >= a1) && (chose < a1 + a2 ) )
  1288   else if ( (chose >= a1 + a2 ) && (chose < a1 + a2 + a3 ) ) 
  1298   else if ( (chose >= a1 + a2 + a3  ) && (chose < a1 + a2 + a3 + a4  ) )
  1307   else if( (chose >= a1 + a2 + a3 + a4  )&&(chose < a1 + a2 + a3 + a4 + a5 ) )
 
void set(double x, double y, double z)
ThreeVector shoot(const G4int Ap, const G4int Af)
std::ostream & StreamInfo(std::ostream &os) const
static const G4double kInfinity
G4int GetNumberOfRotationStepsAtTimeOfCreation() const
CLHEP::Hep3Vector G4ThreeVector
virtual G4ThreeVector GetNormal(const G4ThreeVector &xx, G4bool isGlobal)=0
G4ThreeVector GetPointOnSurface() const
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcnorm=G4bool(false), G4bool *validnorm=0, G4ThreeVector *n=0) const
G4VisExtent GetExtent() const
G4int createPolyhedron(G4int Nnodes, G4int Nfaces, const G4double xyz[][3], const G4int faces[][4])
static void AddPolyToExtent(const G4ThreeVector &v0, const G4ThreeVector &v1, const G4ThreeVector &w1, const G4ThreeVector &w0, const G4VoxelLimits &voxellimit, const EAxis axis, G4SolidExtentList &extentlist)
G4VTwistSurface * fFormerTwisted
void SetNormal(const G4ThreeVector &newNormal)
G4double fEndOuterRadius[2]
LastValueWithDoubleVector fLastDistanceToInWithV
virtual G4bool PartialClip(const G4VoxelLimits &voxelLimit, const EAxis IgnoreMe)
virtual void AddVertexInOrder(const G4ThreeVector vertex)
LastValue fLastDistanceToIn
virtual void AddSolid(const G4Box &)=0
void ComputeDimensions(G4VPVParameterisation *, const G4int, const G4VPhysicalVolume *)
G4double fEndInnerRadius[2]
#define G4MUTEX_INITIALIZER
G4VTwistSurface * fUpperEndcap
G4bool GetExtent(G4double &min, G4double &max) const
EInside Inside(const G4ThreeVector &p) const
virtual G4double DistanceToIn(const G4ThreeVector &gp, const G4ThreeVector &gv, G4ThreeVector &gxxbest)
G4bool CalculateExtent(const EAxis paxis, const G4VoxelLimits &pvoxellimit, const G4AffineTransform &ptransform, G4double &pmin, G4double &pmax) const
static double normal(HepRandomEngine *eptr)
G4VTwistSurface * fOuterHype
G4Polyhedron * GetPolyhedron() const
virtual G4double GetSurfaceArea()=0
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
G4bool IsValidNorm() const
G4double GetRadialTolerance() 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
G4VTwistSurface ** surface
static const double twopi
void SetFields(G4double phitwist, G4double innerrad, G4double outerrad, G4double negativeEndz, G4double positiveEndz)
G4double GetEndInnerRadius() const
G4bool fRebuildPolyhedron
void AddSurface(const G4ClippablePolygon &surface)
LastValueWithDoubleVector fLastDistanceToOutWithV
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
virtual G4double GetBoundaryMax(G4double)=0
G4double GetSurfaceArea()
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
LastValue fLastDistanceToOut
virtual void GetFacets(G4int m, G4int n, G4double xyz[][3], G4int faces[][4], G4int iside)=0
virtual G4double GetBoundaryMin(G4double)=0
G4VTwistSurface * fLatterTwisted
static G4int GetNumberOfRotationSteps()
G4Polyhedron * CreatePolyhedron() const
G4GeometryType GetEntityType() const
G4VTwistSurface * fInnerHype
void DescribeYourselfTo(G4VGraphicsScene &scene) const
static const double degree
HepRotation & rotateZ(double delta)
G4double fTanInnerStereo2
G4Polyhedron * fpPolyhedron
G4TwistedTubs(const G4String &pname, G4double twistedangle, G4double endinnerrad, G4double endouterrad, G4double halfzlen, G4double dphi)
G4VSolid & operator=(const G4VSolid &rhs)
G4double fTanOuterStereo2
G4double GetCubicVolume()
G4double GetEndOuterRadius() const
G4VTwistSurface * fLowerEndcap
virtual G4double GetSurfaceArea()
static G4GeometryTolerance * GetInstance()
G4TwistedTubs & operator=(const G4TwistedTubs &rhs)