Geant4-11
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
G4Para Class Reference

#include <G4Para.hh>

Inheritance diagram for G4Para:
G4CSGSolid G4VSolid

Public Member Functions

void BoundingLimits (G4ThreeVector &pMin, G4ThreeVector &pMax) const
 
G4bool CalculateExtent (const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
 
G4VSolidClone () const
 
void ComputeDimensions (G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
 
G4PolyhedronCreatePolyhedron () const
 
void DescribeYourselfTo (G4VGraphicsScene &scene) const
 
G4double DistanceToIn (const G4ThreeVector &p) const
 
G4double DistanceToIn (const G4ThreeVector &p, const G4ThreeVector &v) const
 
G4double DistanceToOut (const G4ThreeVector &p) const
 
G4double DistanceToOut (const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const
 
void DumpInfo () const
 
G4double EstimateCubicVolume (G4int nStat, G4double epsilon) const
 
G4double EstimateSurfaceArea (G4int nStat, G4double ell) const
 
 G4Para (__void__ &)
 
 G4Para (const G4Para &rhs)
 
 G4Para (const G4String &pName, const G4ThreeVector pt[8])
 
 G4Para (const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
 
G4double GetAlpha () const
 
virtual G4VSolidGetConstituentSolid (G4int no)
 
virtual const G4VSolidGetConstituentSolid (G4int no) const
 
G4double GetCubicVolume ()
 
virtual G4DisplacedSolidGetDisplacedSolidPtr ()
 
virtual const G4DisplacedSolidGetDisplacedSolidPtr () const
 
G4GeometryType GetEntityType () const
 
virtual G4VisExtent GetExtent () const
 
G4String GetName () const
 
G4double GetPhi () const
 
G4ThreeVector GetPointOnSurface () const
 
virtual G4PolyhedronGetPolyhedron () const
 
G4double GetSurfaceArea ()
 
G4ThreeVector GetSymAxis () const
 
G4double GetTanAlpha () const
 
G4double GetTheta () const
 
G4double GetTolerance () const
 
G4double GetXHalfLength () const
 
G4double GetYHalfLength () const
 
G4double GetZHalfLength () const
 
EInside Inside (const G4ThreeVector &p) const
 
G4Paraoperator= (const G4Para &rhs)
 
G4bool operator== (const G4VSolid &s) const
 
void SetAllParameters (G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
 
void SetAlpha (G4double alpha)
 
void SetName (const G4String &name)
 
void SetTanAlpha (G4double val)
 
void SetThetaAndPhi (double pTheta, double pPhi)
 
void SetXHalfLength (G4double val)
 
void SetYHalfLength (G4double val)
 
void SetZHalfLength (G4double val)
 
std::ostream & StreamInfo (std::ostream &os) const
 
G4ThreeVector SurfaceNormal (const G4ThreeVector &p) const
 
virtual ~G4Para ()
 

Protected Member Functions

void CalculateClippedPolygonExtent (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipBetweenSections (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipCrossSection (G4ThreeVectorList *pVertices, const G4int pSectionIndex, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
 
void ClipPolygon (G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
 
G4double GetRadiusInRing (G4double rmin, G4double rmax) const
 

Protected Attributes

G4double fCubicVolume = 0.0
 
G4PolyhedronfpPolyhedron = nullptr
 
G4bool fRebuildPolyhedron = false
 
G4double fSurfaceArea = 0.0
 
G4double kCarTolerance
 

Private Member Functions

G4ThreeVector ApproxSurfaceNormal (const G4ThreeVector &p) const
 
void CheckParameters ()
 
void ClipPolygonToSimpleLimits (G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
 
void MakePlanes ()
 

Private Attributes

G4double fDx
 
G4double fDy
 
G4double fDz
 
struct {
   G4double   a
 
   G4double   b
 
   G4double   c
 
   G4double   d
 
fPlanes [4]
 
G4String fshapeName
 
G4double fTalpha
 
G4double fTthetaCphi
 
G4double fTthetaSphi
 
G4double halfCarTolerance
 

Detailed Description

Definition at line 78 of file G4Para.hh.

Constructor & Destructor Documentation

◆ G4Para() [1/4]

G4Para::G4Para ( const G4String pName,
G4double  pDx,
G4double  pDy,
G4double  pDz,
G4double  pAlpha,
G4double  pTheta,
G4double  pPhi 
)

Definition at line 53 of file G4Para.cc.

57{
58 SetAllParameters(pDx, pDy, pDz, pAlpha, pTheta, pPhi);
59 fRebuildPolyhedron = false; // default value for G4CSGSolid
60}
G4bool fRebuildPolyhedron
Definition: G4CSGSolid.hh:72
G4CSGSolid(const G4String &pName)
Definition: G4CSGSolid.cc:49
G4double halfCarTolerance
Definition: G4Para.hh:185
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:185
G4double kCarTolerance
Definition: G4VSolid.hh:299

References G4CSGSolid::fRebuildPolyhedron, and SetAllParameters().

Referenced by Clone().

◆ G4Para() [2/4]

G4Para::G4Para ( const G4String pName,
const G4ThreeVector  pt[8] 
)

Definition at line 66 of file G4Para.cc.

69{
70 // Find dimensions and trigonometric values
71 //
72 fDx = (pt[3].x() - pt[2].x())*0.5;
73 fDy = (pt[2].y() - pt[1].y())*0.5;
74 fDz = pt[7].z();
75 CheckParameters(); // check dimensions
76
77 fTalpha = (pt[2].x() + pt[3].x() - pt[1].x() - pt[0].x())*0.25/fDy;
78 fTthetaCphi = (pt[4].x() + fDy*fTalpha + fDx)/fDz;
79 fTthetaSphi = (pt[4].y() + fDy)/fDz;
80 MakePlanes();
81
82 // Recompute vertices
83 //
84 G4ThreeVector v[8];
85 G4double DyTalpha = fDy*fTalpha;
86 G4double DzTthetaSphi = fDz*fTthetaSphi;
87 G4double DzTthetaCphi = fDz*fTthetaCphi;
88 v[0].set(-DzTthetaCphi-DyTalpha-fDx, -DzTthetaSphi-fDy, -fDz);
89 v[1].set(-DzTthetaCphi-DyTalpha+fDx, -DzTthetaSphi-fDy, -fDz);
90 v[2].set(-DzTthetaCphi+DyTalpha-fDx, -DzTthetaSphi+fDy, -fDz);
91 v[3].set(-DzTthetaCphi+DyTalpha+fDx, -DzTthetaSphi+fDy, -fDz);
92 v[4].set( DzTthetaCphi-DyTalpha-fDx, DzTthetaSphi-fDy, fDz);
93 v[5].set( DzTthetaCphi-DyTalpha+fDx, DzTthetaSphi-fDy, fDz);
94 v[6].set( DzTthetaCphi+DyTalpha-fDx, DzTthetaSphi+fDy, fDz);
95 v[7].set( DzTthetaCphi+DyTalpha+fDx, DzTthetaSphi+fDy, fDz);
96
97 // Compare with original vertices
98 //
99 for (G4int i=0; i<8; ++i)
100 {
101 G4double delx = std::abs(pt[i].x() - v[i].x());
102 G4double dely = std::abs(pt[i].y() - v[i].y());
103 G4double delz = std::abs(pt[i].z() - v[i].z());
104 G4double discrepancy = std::max(std::max(delx,dely),delz);
105 if (discrepancy > 0.1*kCarTolerance)
106 {
107 std::ostringstream message;
108 G4int oldprc = message.precision(16);
109 message << "Invalid vertice coordinates for Solid: " << GetName()
110 << "\nVertix #" << i << ", discrepancy = " << discrepancy
111 << "\n original : " << pt[i]
112 << "\n recomputed : " << v[i];
113 G4cout.precision(oldprc);
114 G4Exception("G4Para::G4Para()", "GeomSolids0002",
115 FatalException, message);
116
117 }
118 }
119}
@ FatalException
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Definition: G4Exception.cc:35
double G4double
Definition: G4Types.hh:83
int G4int
Definition: G4Types.hh:85
G4GLOB_DLL std::ostream G4cout
double z() const
double x() const
double y() const
void set(double x, double y, double z)
G4double fTthetaSphi
Definition: G4Para.hh:187
G4double fDy
Definition: G4Para.hh:186
G4double fTthetaCphi
Definition: G4Para.hh:187
void CheckParameters()
Definition: G4Para.cc:209
G4double fTalpha
Definition: G4Para.hh:187
void MakePlanes()
Definition: G4Para.cc:230
G4double fDx
Definition: G4Para.hh:186
G4double fDz
Definition: G4Para.hh:186
G4String GetName() const
T max(const T t1, const T t2)
brief Return the largest of the two arguments

References CheckParameters(), FatalException, fDx, fDy, fDz, fTalpha, fTthetaCphi, fTthetaSphi, G4cout, G4Exception(), G4VSolid::GetName(), G4VSolid::kCarTolerance, MakePlanes(), G4INCL::Math::max(), CLHEP::Hep3Vector::set(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ ~G4Para()

G4Para::~G4Para ( )
virtual

Definition at line 137 of file G4Para.cc.

138{
139}

◆ G4Para() [3/4]

G4Para::G4Para ( __void__ &  a)

Definition at line 126 of file G4Para.cc.

128{
129 SetAllParameters(1., 1., 1., 0., 0., 0.);
130 fRebuildPolyhedron = false; // default value for G4CSGSolid
131}
G4double a
Definition: G4Para.hh:188

References G4CSGSolid::fRebuildPolyhedron, and SetAllParameters().

◆ G4Para() [4/4]

G4Para::G4Para ( const G4Para rhs)

Definition at line 145 of file G4Para.cc.

147 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTalpha(rhs.fTalpha),
149{
150 for (G4int i=0; i<4; ++i) { fPlanes[i] = rhs.fPlanes[i]; }
151}
struct G4Para::@22 fPlanes[4]

References fPlanes.

Member Function Documentation

◆ ApproxSurfaceNormal()

G4ThreeVector G4Para::ApproxSurfaceNormal ( const G4ThreeVector p) const
private

Definition at line 515 of file G4Para.cc.

516{
517 G4double dist = -DBL_MAX;
518 G4int iside = 0;
519 for (G4int i=0; i<4; ++i)
520 {
521 G4double d = fPlanes[i].a*p.x() +
522 fPlanes[i].b*p.y() +
523 fPlanes[i].c*p.z() + fPlanes[i].d;
524 if (d > dist) { dist = d; iside = i; }
525 }
526
527 G4double distz = std::abs(p.z()) - fDz;
528 if (dist > distz)
529 return G4ThreeVector(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c);
530 else
531 return G4ThreeVector(0, 0, (p.z() < 0) ? -1 : 1);
532}
CLHEP::Hep3Vector G4ThreeVector
G4double d
Definition: G4Para.hh:188
G4double b
Definition: G4Para.hh:188
G4double c
Definition: G4Para.hh:188
#define DBL_MAX
Definition: templates.hh:62

References a, b, c, d, DBL_MAX, fDz, fPlanes, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by SurfaceNormal().

◆ BoundingLimits()

void G4Para::BoundingLimits ( G4ThreeVector pMin,
G4ThreeVector pMax 
) const
virtual

Reimplemented from G4VSolid.

Definition at line 316 of file G4Para.cc.

317{
321
322 G4double x0 = dz*fTthetaCphi;
323 G4double x1 = dy*GetTanAlpha();
324 G4double xmin =
325 std::min(
326 std::min(
327 std::min(-x0-x1-dx,-x0+x1-dx),x0-x1-dx),x0+x1-dx);
328 G4double xmax =
329 std::max(
330 std::max(
331 std::max(-x0-x1+dx,-x0+x1+dx),x0-x1+dx),x0+x1+dx);
332
333 G4double y0 = dz*fTthetaSphi;
334 G4double ymin = std::min(-y0-dy,y0-dy);
335 G4double ymax = std::max(-y0+dy,y0+dy);
336
337 pMin.set(xmin,ymin,-dz);
338 pMax.set(xmax,ymax, dz);
339
340 // Check correctness of the bounding box
341 //
342 if (pMin.x() >= pMax.x() || pMin.y() >= pMax.y() || pMin.z() >= pMax.z())
343 {
344 std::ostringstream message;
345 message << "Bad bounding box (min >= max) for solid: "
346 << GetName() << " !"
347 << "\npMin = " << pMin
348 << "\npMax = " << pMax;
349 G4Exception("G4Para::BoundingLimits()", "GeomMgt0001",
350 JustWarning, message);
351 DumpInfo();
352 }
353}
@ JustWarning
static const G4double pMax
static const G4double pMin
G4double GetTanAlpha() const
G4double GetYHalfLength() const
G4double GetZHalfLength() const
G4double GetXHalfLength() const
void DumpInfo() const
T min(const T t1, const T t2)
brief Return the smallest of the two arguments

References G4VSolid::DumpInfo(), fTthetaCphi, fTthetaSphi, G4Exception(), G4VSolid::GetName(), GetTanAlpha(), GetXHalfLength(), GetYHalfLength(), GetZHalfLength(), JustWarning, G4INCL::Math::max(), G4INCL::Math::min(), pMax, and pMin.

Referenced by CalculateExtent().

◆ CalculateClippedPolygonExtent()

void G4VSolid::CalculateClippedPolygonExtent ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 489 of file G4VSolid.cc.

494{
495 G4int noLeft,i;
496 G4double component;
497
498 ClipPolygon(pPolygon,pVoxelLimit,pAxis);
499 noLeft = pPolygon.size();
500
501 if ( noLeft )
502 {
503 for (i=0; i<noLeft; ++i)
504 {
505 component = pPolygon[i].operator()(pAxis);
506
507 if (component < pMin)
508 {
509 pMin = component;
510 }
511 if (component > pMax)
512 {
513 pMax = component;
514 }
515 }
516 }
517}
void ClipPolygon(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis) const
Definition: G4VSolid.cc:539

References G4VSolid::ClipPolygon(), pMax, and pMin.

Referenced by G4VSolid::ClipBetweenSections(), and G4VSolid::ClipCrossSection().

◆ CalculateExtent()

G4bool G4Para::CalculateExtent ( const EAxis  pAxis,
const G4VoxelLimits pVoxelLimit,
const G4AffineTransform pTransform,
G4double pMin,
G4double pMax 
) const
virtual

Implements G4VSolid.

Definition at line 359 of file G4Para.cc.

363{
364 G4ThreeVector bmin, bmax;
365 G4bool exist;
366
367 // Check bounding box (bbox)
368 //
369 BoundingLimits(bmin,bmax);
370 G4BoundingEnvelope bbox(bmin,bmax);
371#ifdef G4BBOX_EXTENT
372 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
373#endif
374 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
375 {
376 return exist = (pMin < pMax) ? true : false;
377 }
378
379 // Set bounding envelope (benv) and calculate extent
380 //
384
385 G4double x0 = dz*fTthetaCphi;
386 G4double x1 = dy*GetTanAlpha();
387 G4double y0 = dz*fTthetaSphi;
388
389 G4ThreeVectorList baseA(4), baseB(4);
390 baseA[0].set(-x0-x1-dx,-y0-dy,-dz);
391 baseA[1].set(-x0-x1+dx,-y0-dy,-dz);
392 baseA[2].set(-x0+x1+dx,-y0+dy,-dz);
393 baseA[3].set(-x0+x1-dx,-y0+dy,-dz);
394
395 baseB[0].set(+x0-x1-dx, y0-dy, dz);
396 baseB[1].set(+x0-x1+dx, y0-dy, dz);
397 baseB[2].set(+x0+x1+dx, y0+dy, dz);
398 baseB[3].set(+x0+x1-dx, y0+dy, dz);
399
400 std::vector<const G4ThreeVectorList *> polygons(2);
401 polygons[0] = &baseA;
402 polygons[1] = &baseB;
403
404 G4BoundingEnvelope benv(bmin,bmax,polygons);
405 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
406 return exist;
407}
std::vector< G4ThreeVector > G4ThreeVectorList
bool G4bool
Definition: G4Types.hh:86
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4Para.cc:316

References G4BoundingEnvelope::BoundingBoxVsVoxelLimits(), BoundingLimits(), G4BoundingEnvelope::CalculateExtent(), fTthetaCphi, fTthetaSphi, GetTanAlpha(), GetXHalfLength(), GetYHalfLength(), GetZHalfLength(), pMax, and pMin.

◆ CheckParameters()

void G4Para::CheckParameters ( )
private

Definition at line 209 of file G4Para.cc.

210{
211 if (fDx < 2*kCarTolerance ||
212 fDy < 2*kCarTolerance ||
213 fDz < 2*kCarTolerance)
214 {
215 std::ostringstream message;
216 message << "Invalid (too small or negative) dimensions for Solid: "
217 << GetName()
218 << "\n X - " << fDx
219 << "\n Y - " << fDy
220 << "\n Z - " << fDz;
221 G4Exception("G4Para::CheckParameters()", "GeomSolids0002",
222 FatalException, message);
223 }
224}

References FatalException, fDx, fDy, fDz, G4Exception(), G4VSolid::GetName(), and G4VSolid::kCarTolerance.

Referenced by G4Para(), and SetAllParameters().

◆ ClipBetweenSections()

void G4VSolid::ClipBetweenSections ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 444 of file G4VSolid.cc.

449{
450 G4ThreeVectorList polygon;
451 polygon.reserve(4);
452 polygon.push_back((*pVertices)[pSectionIndex]);
453 polygon.push_back((*pVertices)[pSectionIndex+4]);
454 polygon.push_back((*pVertices)[pSectionIndex+5]);
455 polygon.push_back((*pVertices)[pSectionIndex+1]);
456 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
457 polygon.clear();
458
459 polygon.push_back((*pVertices)[pSectionIndex+1]);
460 polygon.push_back((*pVertices)[pSectionIndex+5]);
461 polygon.push_back((*pVertices)[pSectionIndex+6]);
462 polygon.push_back((*pVertices)[pSectionIndex+2]);
463 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
464 polygon.clear();
465
466 polygon.push_back((*pVertices)[pSectionIndex+2]);
467 polygon.push_back((*pVertices)[pSectionIndex+6]);
468 polygon.push_back((*pVertices)[pSectionIndex+7]);
469 polygon.push_back((*pVertices)[pSectionIndex+3]);
470 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
471 polygon.clear();
472
473 polygon.push_back((*pVertices)[pSectionIndex+3]);
474 polygon.push_back((*pVertices)[pSectionIndex+7]);
475 polygon.push_back((*pVertices)[pSectionIndex+4]);
476 polygon.push_back((*pVertices)[pSectionIndex]);
477 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
478 return;
479}
void CalculateClippedPolygonExtent(G4ThreeVectorList &pPolygon, const G4VoxelLimits &pVoxelLimit, const EAxis pAxis, G4double &pMin, G4double &pMax) const
Definition: G4VSolid.cc:489

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipCrossSection()

void G4VSolid::ClipCrossSection ( G4ThreeVectorList pVertices,
const G4int  pSectionIndex,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis,
G4double pMin,
G4double pMax 
) const
protectedinherited

Definition at line 414 of file G4VSolid.cc.

419{
420
421 G4ThreeVectorList polygon;
422 polygon.reserve(4);
423 polygon.push_back((*pVertices)[pSectionIndex]);
424 polygon.push_back((*pVertices)[pSectionIndex+1]);
425 polygon.push_back((*pVertices)[pSectionIndex+2]);
426 polygon.push_back((*pVertices)[pSectionIndex+3]);
427 CalculateClippedPolygonExtent(polygon,pVoxelLimit,pAxis,pMin,pMax);
428 return;
429}

References G4VSolid::CalculateClippedPolygonExtent(), pMax, and pMin.

◆ ClipPolygon()

void G4VSolid::ClipPolygon ( G4ThreeVectorList pPolygon,
const G4VoxelLimits pVoxelLimit,
const EAxis  pAxis 
) const
protectedinherited

Definition at line 539 of file G4VSolid.cc.

542{
543 G4ThreeVectorList outputPolygon;
544
545 if ( pVoxelLimit.IsLimited() )
546 {
547 if (pVoxelLimit.IsXLimited() ) // && pAxis != kXAxis)
548 {
549 G4VoxelLimits simpleLimit1;
550 simpleLimit1.AddLimit(kXAxis,pVoxelLimit.GetMinXExtent(),kInfinity);
551 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
552
553 pPolygon.clear();
554
555 if ( !outputPolygon.size() ) return;
556
557 G4VoxelLimits simpleLimit2;
558 simpleLimit2.AddLimit(kXAxis,-kInfinity,pVoxelLimit.GetMaxXExtent());
559 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
560
561 if ( !pPolygon.size() ) return;
562 else outputPolygon.clear();
563 }
564 if ( pVoxelLimit.IsYLimited() ) // && pAxis != kYAxis)
565 {
566 G4VoxelLimits simpleLimit1;
567 simpleLimit1.AddLimit(kYAxis,pVoxelLimit.GetMinYExtent(),kInfinity);
568 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
569
570 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
571 // early exit
572
573 pPolygon.clear();
574
575 if ( !outputPolygon.size() ) return;
576
577 G4VoxelLimits simpleLimit2;
578 simpleLimit2.AddLimit(kYAxis,-kInfinity,pVoxelLimit.GetMaxYExtent());
579 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
580
581 if ( !pPolygon.size() ) return;
582 else outputPolygon.clear();
583 }
584 if ( pVoxelLimit.IsZLimited() ) // && pAxis != kZAxis)
585 {
586 G4VoxelLimits simpleLimit1;
587 simpleLimit1.AddLimit(kZAxis,pVoxelLimit.GetMinZExtent(),kInfinity);
588 ClipPolygonToSimpleLimits(pPolygon,outputPolygon,simpleLimit1);
589
590 // Must always clear pPolygon - for clip to simpleLimit2 and in case of
591 // early exit
592
593 pPolygon.clear();
594
595 if ( !outputPolygon.size() ) return;
596
597 G4VoxelLimits simpleLimit2;
598 simpleLimit2.AddLimit(kZAxis,-kInfinity,pVoxelLimit.GetMaxZExtent());
599 ClipPolygonToSimpleLimits(outputPolygon,pPolygon,simpleLimit2);
600
601 // Return after final clip - no cleanup
602 }
603 }
604}
void ClipPolygonToSimpleLimits(G4ThreeVectorList &pPolygon, G4ThreeVectorList &outputPolygon, const G4VoxelLimits &pVoxelLimit) const
Definition: G4VSolid.cc:612
G4bool IsYLimited() const
G4double GetMinZExtent() const
void AddLimit(const EAxis pAxis, const G4double pMin, const G4double pMax)
G4bool IsXLimited() const
G4double GetMaxYExtent() const
G4double GetMaxZExtent() const
G4double GetMinYExtent() const
G4double GetMinXExtent() const
G4bool IsZLimited() const
G4bool IsLimited() const
G4double GetMaxXExtent() const
@ kYAxis
Definition: geomdefs.hh:56
@ kXAxis
Definition: geomdefs.hh:55
@ kZAxis
Definition: geomdefs.hh:57
static const G4double kInfinity
Definition: geomdefs.hh:41

References G4VoxelLimits::AddLimit(), G4VSolid::ClipPolygonToSimpleLimits(), G4VoxelLimits::GetMaxXExtent(), G4VoxelLimits::GetMaxYExtent(), G4VoxelLimits::GetMaxZExtent(), G4VoxelLimits::GetMinXExtent(), G4VoxelLimits::GetMinYExtent(), G4VoxelLimits::GetMinZExtent(), G4VoxelLimits::IsLimited(), G4VoxelLimits::IsXLimited(), G4VoxelLimits::IsYLimited(), G4VoxelLimits::IsZLimited(), kInfinity, kXAxis, kYAxis, and kZAxis.

Referenced by G4VSolid::CalculateClippedPolygonExtent().

◆ ClipPolygonToSimpleLimits()

void G4VSolid::ClipPolygonToSimpleLimits ( G4ThreeVectorList pPolygon,
G4ThreeVectorList outputPolygon,
const G4VoxelLimits pVoxelLimit 
) const
privateinherited

Definition at line 612 of file G4VSolid.cc.

615{
616 G4int i;
617 G4int noVertices=pPolygon.size();
618 G4ThreeVector vEnd,vStart;
619
620 for (i = 0 ; i < noVertices ; ++i )
621 {
622 vStart = pPolygon[i];
623 if ( i == noVertices-1 ) vEnd = pPolygon[0];
624 else vEnd = pPolygon[i+1];
625
626 if ( pVoxelLimit.Inside(vStart) )
627 {
628 if (pVoxelLimit.Inside(vEnd))
629 {
630 // vStart and vEnd inside -> output end point
631 //
632 outputPolygon.push_back(vEnd);
633 }
634 else
635 {
636 // vStart inside, vEnd outside -> output crossing point
637 //
638 pVoxelLimit.ClipToLimits(vStart,vEnd);
639 outputPolygon.push_back(vEnd);
640 }
641 }
642 else
643 {
644 if (pVoxelLimit.Inside(vEnd))
645 {
646 // vStart outside, vEnd inside -> output inside section
647 //
648 pVoxelLimit.ClipToLimits(vStart,vEnd);
649 outputPolygon.push_back(vStart);
650 outputPolygon.push_back(vEnd);
651 }
652 else // Both point outside -> no output
653 {
654 // outputPolygon.push_back(vStart);
655 // outputPolygon.push_back(vEnd);
656 }
657 }
658 }
659}
G4bool ClipToLimits(G4ThreeVector &pStart, G4ThreeVector &pEnd) const
G4bool Inside(const G4ThreeVector &pVec) const

References G4VoxelLimits::ClipToLimits(), and G4VoxelLimits::Inside().

Referenced by G4VSolid::ClipPolygon().

◆ Clone()

G4VSolid * G4Para::Clone ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 803 of file G4Para.cc.

804{
805 return new G4Para(*this);
806}
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
Definition: G4Para.cc:53

References G4Para().

◆ ComputeDimensions()

void G4Para::ComputeDimensions ( G4VPVParameterisation p,
const G4int  n,
const G4VPhysicalVolume pRep 
)
virtual

Reimplemented from G4VSolid.

Definition at line 305 of file G4Para.cc.

308{
309 p->ComputeDimensions(*this,n,pRep);
310}
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const

References G4VPVParameterisation::ComputeDimensions(), and CLHEP::detail::n.

◆ CreatePolyhedron()

G4Polyhedron * G4Para::CreatePolyhedron ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 899 of file G4Para.cc.

900{
901 G4double phi = std::atan2(fTthetaSphi, fTthetaCphi);
902 G4double alpha = std::atan(fTalpha);
903 G4double theta = std::atan(std::sqrt(fTthetaCphi*fTthetaCphi +
905
906 return new G4PolyhedronPara(fDx, fDy, fDz, alpha, theta, phi);
907}
static const G4double alpha

References alpha, fDx, fDy, fDz, fTalpha, fTthetaCphi, and fTthetaSphi.

◆ DescribeYourselfTo()

void G4Para::DescribeYourselfTo ( G4VGraphicsScene scene) const
virtual

Implements G4VSolid.

Definition at line 894 of file G4Para.cc.

895{
896 scene.AddSolid (*this);
897}
virtual void AddSolid(const G4Box &)=0

References G4VGraphicsScene::AddSolid().

◆ DistanceToIn() [1/2]

G4double G4Para::DistanceToIn ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 629 of file G4Para.cc.

630{
631 G4double xx = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()+fPlanes[2].c*p.z();
632 G4double dx = std::abs(xx) + fPlanes[2].d;
633
634 G4double yy = fPlanes[0].b*p.y()+fPlanes[0].c*p.z();
635 G4double dy = std::abs(yy) + fPlanes[0].d;
636 G4double dxy = std::max(dx,dy);
637
638 G4double dz = std::abs(p.z())-fDz;
639 G4double dist = std::max(dxy,dz);
640
641 return (dist > 0) ? dist : 0.;
642}

References fDz, fPlanes, G4INCL::Math::max(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToIn() [2/2]

G4double G4Para::DistanceToIn ( const G4ThreeVector p,
const G4ThreeVector v 
) const
virtual

Implements G4VSolid.

Definition at line 539 of file G4Para.cc.

541{
542 // Z intersections
543 //
544 if ((std::abs(p.z()) - fDz) >= -halfCarTolerance && p.z()*v.z() >= 0)
545 return kInfinity;
546 G4double invz = (-v.z() == 0) ? DBL_MAX : -1./v.z();
547 G4double dz = (invz < 0) ? fDz : -fDz;
548 G4double tzmin = (p.z() + dz)*invz;
549 G4double tzmax = (p.z() - dz)*invz;
550
551 // Y intersections
552 //
553 G4double tmin0 = tzmin, tmax0 = tzmax;
554 G4double cos0 = fPlanes[0].b*v.y() + fPlanes[0].c*v.z();
555 G4double disy = fPlanes[0].b*p.y() + fPlanes[0].c*p.z();
556 G4double dis0 = fPlanes[0].d + disy;
557 if (dis0 >= -halfCarTolerance)
558 {
559 if (cos0 >= 0) return kInfinity;
560 G4double tmp = -dis0/cos0;
561 if (tmin0 < tmp) tmin0 = tmp;
562 }
563 else if (cos0 > 0)
564 {
565 G4double tmp = -dis0/cos0;
566 if (tmax0 > tmp) tmax0 = tmp;
567 }
568
569 G4double tmin1 = tmin0, tmax1 = tmax0;
570 G4double cos1 = -cos0;
571 G4double dis1 = fPlanes[1].d - disy;
572 if (dis1 >= -halfCarTolerance)
573 {
574 if (cos1 >= 0) return kInfinity;
575 G4double tmp = -dis1/cos1;
576 if (tmin1 < tmp) tmin1 = tmp;
577 }
578 else if (cos1 > 0)
579 {
580 G4double tmp = -dis1/cos1;
581 if (tmax1 > tmp) tmax1 = tmp;
582 }
583
584 // X intersections
585 //
586 G4double tmin2 = tmin1, tmax2 = tmax1;
587 G4double cos2 = fPlanes[2].a*v.x() + fPlanes[2].b*v.y() + fPlanes[2].c*v.z();
588 G4double disx = fPlanes[2].a*p.x() + fPlanes[2].b*p.y() + fPlanes[2].c*p.z();
589 G4double dis2 = fPlanes[2].d + disx;
590 if (dis2 >= -halfCarTolerance)
591 {
592 if (cos2 >= 0) return kInfinity;
593 G4double tmp = -dis2/cos2;
594 if (tmin2 < tmp) tmin2 = tmp;
595 }
596 else if (cos2 > 0)
597 {
598 G4double tmp = -dis2/cos2;
599 if (tmax2 > tmp) tmax2 = tmp;
600 }
601
602 G4double tmin3 = tmin2, tmax3 = tmax2;
603 G4double cos3 = -cos2;
604 G4double dis3 = fPlanes[3].d - disx;
605 if (dis3 >= -halfCarTolerance)
606 {
607 if (cos3 >= 0) return kInfinity;
608 G4double tmp = -dis3/cos3;
609 if (tmin3 < tmp) tmin3 = tmp;
610 }
611 else if (cos3 > 0)
612 {
613 G4double tmp = -dis3/cos3;
614 if (tmax3 > tmp) tmax3 = tmp;
615 }
616
617 // Find distance
618 //
619 G4double tmin = tmin3, tmax = tmax3;
620 if (tmax <= tmin + halfCarTolerance) return kInfinity; // touch or no hit
621 return (tmin < halfCarTolerance ) ? 0. : tmin;
622}

References DBL_MAX, fDz, fPlanes, halfCarTolerance, kInfinity, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToOut() [1/2]

G4double G4Para::DistanceToOut ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 759 of file G4Para.cc.

760{
761#ifdef G4CSGDEBUG
762 if( Inside(p) == kOutside )
763 {
764 std::ostringstream message;
765 G4int oldprc = message.precision(16);
766 message << "Point p is outside (!?) of solid: " << GetName() << G4endl;
767 message << "Position:\n";
768 message << " p.x() = " << p.x()/mm << " mm\n";
769 message << " p.y() = " << p.y()/mm << " mm\n";
770 message << " p.z() = " << p.z()/mm << " mm";
771 G4cout.precision(oldprc) ;
772 G4Exception("G4Para::DistanceToOut(p)", "GeomSolids1002",
773 JustWarning, message );
774 DumpInfo();
775 }
776#endif
777 G4double xx = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()+fPlanes[2].c*p.z();
778 G4double dx = std::abs(xx) + fPlanes[2].d;
779
780 G4double yy = fPlanes[0].b*p.y()+fPlanes[0].c*p.z();
781 G4double dy = std::abs(yy) + fPlanes[0].d;
782 G4double dxy = std::max(dx,dy);
783
784 G4double dz = std::abs(p.z())-fDz;
785 G4double dist = std::max(dxy,dz);
786
787 return (dist < 0) ? -dist : 0.;
788}
static constexpr double mm
Definition: G4SIunits.hh:95
#define G4endl
Definition: G4ios.hh:57
EInside Inside(const G4ThreeVector &p) const
Definition: G4Para.cc:414
@ kOutside
Definition: geomdefs.hh:68

References G4VSolid::DumpInfo(), fDz, fPlanes, G4cout, G4endl, G4Exception(), G4VSolid::GetName(), Inside(), JustWarning, kOutside, G4INCL::Math::max(), mm, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DistanceToOut() [2/2]

G4double G4Para::DistanceToOut ( const G4ThreeVector p,
const G4ThreeVector v,
const G4bool  calcNorm = false,
G4bool validNorm = nullptr,
G4ThreeVector n = nullptr 
) const
virtual

Implements G4VSolid.

Definition at line 650 of file G4Para.cc.

653{
654 // Z intersections
655 //
656 if ((std::abs(p.z()) - fDz) >= -halfCarTolerance && p.z()*v.z() > 0)
657 {
658 if (calcNorm)
659 {
660 *validNorm = true;
661 n->set(0, 0, (p.z() < 0) ? -1 : 1);
662 }
663 return 0.;
664 }
665 G4double vz = v.z();
666 G4double tmax = (vz == 0) ? DBL_MAX : (std::copysign(fDz,vz) - p.z())/vz;
667 G4int iside = (vz < 0) ? -4 : -2; // little trick: (-4+3)=-1, (-2+3)=+1
668
669 // Y intersections
670 //
671 G4double cos0 = fPlanes[0].b*v.y() + fPlanes[0].c*v.z();
672 if (cos0 > 0)
673 {
674 G4double dis0 = fPlanes[0].b*p.y() + fPlanes[0].c*p.z() + fPlanes[0].d;
675 if (dis0 >= -halfCarTolerance)
676 {
677 if (calcNorm)
678 {
679 *validNorm = true;
680 n->set(0, fPlanes[0].b, fPlanes[0].c);
681 }
682 return 0.;
683 }
684 G4double tmp = -dis0/cos0;
685 if (tmax > tmp) { tmax = tmp; iside = 0; }
686 }
687
688 G4double cos1 = -cos0;
689 if (cos1 > 0)
690 {
691 G4double dis1 = fPlanes[1].b*p.y() + fPlanes[1].c*p.z() + fPlanes[1].d;
692 if (dis1 >= -halfCarTolerance)
693 {
694 if (calcNorm)
695 {
696 *validNorm = true;
697 n->set(0, fPlanes[1].b, fPlanes[1].c);
698 }
699 return 0.;
700 }
701 G4double tmp = -dis1/cos1;
702 if (tmax > tmp) { tmax = tmp; iside = 1; }
703 }
704
705 // X intersections
706 //
707 G4double cos2 = fPlanes[2].a*v.x() + fPlanes[2].b*v.y() + fPlanes[2].c*v.z();
708 if (cos2 > 0)
709 {
710 G4double dis2 = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()+fPlanes[2].c*p.z()+fPlanes[2].d;
711 if (dis2 >= -halfCarTolerance)
712 {
713 if (calcNorm)
714 {
715 *validNorm = true;
716 n->set(fPlanes[2].a, fPlanes[2].b, fPlanes[2].c);
717 }
718 return 0.;
719 }
720 G4double tmp = -dis2/cos2;
721 if (tmax > tmp) { tmax = tmp; iside = 2; }
722 }
723
724 G4double cos3 = -cos2;
725 if (cos3 > 0)
726 {
727 G4double dis3 = fPlanes[3].a*p.x()+fPlanes[3].b*p.y()+fPlanes[3].c*p.z()+fPlanes[3].d;
728 if (dis3 >= -halfCarTolerance)
729 {
730 if (calcNorm)
731 {
732 *validNorm = true;
733 n->set(fPlanes[3].a, fPlanes[3].b, fPlanes[3].c);
734 }
735 return 0.;
736 }
737 G4double tmp = -dis3/cos3;
738 if (tmax > tmp) { tmax = tmp; iside = 3; }
739 }
740
741 // Set normal, if required, and return distance
742 //
743 if (calcNorm)
744 {
745 *validNorm = true;
746 if (iside < 0)
747 n->set(0, 0, iside + 3); // (-4+3)=-1, (-2+3)=+1
748 else
749 n->set(fPlanes[iside].a, fPlanes[iside].b, fPlanes[iside].c);
750 }
751 return tmax;
752}

References a, b, c, DBL_MAX, fDz, fPlanes, halfCarTolerance, CLHEP::detail::n, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

◆ DumpInfo()

void G4VSolid::DumpInfo ( ) const
inlineinherited

Referenced by G4Cons::ApproxSurfaceNormal(), G4CutTubs::ApproxSurfaceNormal(), G4Sphere::ApproxSurfaceNormal(), G4Torus::ApproxSurfaceNormal(), G4Tubs::ApproxSurfaceNormal(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), G4Paraboloid::BoundingLimits(), G4Polycone::BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4ParameterisationBoxX::ComputeDimensions(), G4ParameterisationBoxY::ComputeDimensions(), G4ParameterisationBoxZ::ComputeDimensions(), G4ParameterisationConsRho::ComputeDimensions(), G4ParameterisationConsPhi::ComputeDimensions(), G4ParameterisationConsZ::ComputeDimensions(), G4ParameterisationParaX::ComputeDimensions(), G4ParameterisationParaY::ComputeDimensions(), G4ParameterisationParaZ::ComputeDimensions(), G4ParameterisationPolyconeRho::ComputeDimensions(), G4ParameterisationPolyconePhi::ComputeDimensions(), G4ParameterisationPolyconeZ::ComputeDimensions(), G4ParameterisationPolyhedraRho::ComputeDimensions(), G4ParameterisationPolyhedraPhi::ComputeDimensions(), G4ParameterisationPolyhedraZ::ComputeDimensions(), G4ParameterisationTrdX::ComputeDimensions(), G4ParameterisationTrdY::ComputeDimensions(), G4ParameterisationTrdZ::ComputeDimensions(), G4ParameterisationTubsRho::ComputeDimensions(), G4ParameterisationTubsPhi::ComputeDimensions(), G4ParameterisationTubsZ::ComputeDimensions(), G4ReflectedSolid::ComputeDimensions(), G4DisplacedSolid::ComputeDimensions(), G4ScaledSolid::ComputeDimensions(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4DisplacedSolid::CreatePolyhedron(), G4ScaledSolid::CreatePolyhedron(), G4SubtractionSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), G4Paraboloid::DistanceToOut(), G4VTwistedFaceted::DistanceToOut(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4GenericTrap::DistanceToOut(), export_G4VSolid(), G4Polycone::G4Polycone(), G4Polyhedra::G4Polyhedra(), G4BooleanSolid::GetConstituentSolid(), G4NavigationLogger::PostComputeStepLog(), G4Box::SurfaceNormal(), SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), and G4Tet::SurfaceNormal().

◆ EstimateCubicVolume()

G4double G4VSolid::EstimateCubicVolume ( G4int  nStat,
G4double  epsilon 
) const
inherited

Definition at line 203 of file G4VSolid.cc.

204{
205 G4int iInside=0;
206 G4double px,py,pz,minX,maxX,minY,maxY,minZ,maxZ,volume,halfepsilon;
208 EInside in;
209
210 // values needed for CalculateExtent signature
211
212 G4VoxelLimits limit; // Unlimited
213 G4AffineTransform origin;
214
215 // min max extents of pSolid along X,Y,Z
216
217 CalculateExtent(kXAxis,limit,origin,minX,maxX);
218 CalculateExtent(kYAxis,limit,origin,minY,maxY);
219 CalculateExtent(kZAxis,limit,origin,minZ,maxZ);
220
221 // limits
222
223 if(nStat < 100) nStat = 100;
224 if(epsilon > 0.01) epsilon = 0.01;
225 halfepsilon = 0.5*epsilon;
226
227 for(auto i = 0; i < nStat; ++i )
228 {
229 px = minX-halfepsilon+(maxX-minX+epsilon)*G4QuickRand();
230 py = minY-halfepsilon+(maxY-minY+epsilon)*G4QuickRand();
231 pz = minZ-halfepsilon+(maxZ-minZ+epsilon)*G4QuickRand();
232 p = G4ThreeVector(px,py,pz);
233 in = Inside(p);
234 if(in != kOutside) ++iInside;
235 }
236 volume = (maxX-minX+epsilon)*(maxY-minY+epsilon)
237 * (maxZ-minZ+epsilon)*iInside/nStat;
238 return volume;
239}
G4double epsilon(G4double density, G4double temperature)
static const G4int maxZ
G4double G4QuickRand()
Definition: G4QuickRand.hh:34
virtual G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const =0
virtual EInside Inside(const G4ThreeVector &p) const =0
EInside
Definition: geomdefs.hh:67

References G4VSolid::CalculateExtent(), epsilon(), G4QuickRand(), G4VSolid::Inside(), kOutside, kXAxis, kYAxis, kZAxis, and maxZ.

Referenced by G4VSolid::GetCubicVolume(), G4BooleanSolid::GetCubicVolume(), and G4VCSGfaceted::GetCubicVolume().

◆ EstimateSurfaceArea()

G4double G4VSolid::EstimateSurfaceArea ( G4int  nStat,
G4double  ell 
) const
inherited

Definition at line 265 of file G4VSolid.cc.

266{
267 static const G4double s2 = 1./std::sqrt(2.);
268 static const G4double s3 = 1./std::sqrt(3.);
269 static const G4ThreeVector directions[64] =
270 {
271 G4ThreeVector( 0, 0, 0), G4ThreeVector( -1, 0, 0), // ( , , ) ( -, , )
272 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, , ) (-+, , )
273 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -, ) ( -, -, )
274 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -, ) (-+, -, )
275
276 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +, ) ( -, +, )
277 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +, ) (-+, +, )
278 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+, ) ( -,-+, )
279 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+, ) (-+,-+, )
280
281 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( , , -) ( -, , -)
282 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +, , -) (-+, , -)
283 G4ThreeVector( 0,-s2,-s2), G4ThreeVector(-s3,-s3,-s3), // ( , -, -) ( -, -, -)
284 G4ThreeVector( s3,-s3,-s3), G4ThreeVector( 0,-s2,-s2), // ( +, -, -) (-+, -, -)
285
286 G4ThreeVector( 0, s2,-s2), G4ThreeVector(-s3, s3,-s3), // ( , +, -) ( -, +, -)
287 G4ThreeVector( s3, s3,-s3), G4ThreeVector( 0, s2,-s2), // ( +, +, -) (-+, +, -)
288 G4ThreeVector( 0, 0, -1), G4ThreeVector(-s2, 0,-s2), // ( ,-+, -) ( -,-+, -)
289 G4ThreeVector( s2, 0,-s2), G4ThreeVector( 0, 0, -1), // ( +,-+, -) (-+,-+, -)
290
291 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( , , +) ( -, , +)
292 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +, , +) (-+, , +)
293 G4ThreeVector( 0,-s2, s2), G4ThreeVector(-s3,-s3, s3), // ( , -, +) ( -, -, +)
294 G4ThreeVector( s3,-s3, s3), G4ThreeVector( 0,-s2, s2), // ( +, -, +) (-+, -, +)
295
296 G4ThreeVector( 0, s2, s2), G4ThreeVector(-s3, s3, s3), // ( , +, +) ( -, +, +)
297 G4ThreeVector( s3, s3, s3), G4ThreeVector( 0, s2, s2), // ( +, +, +) (-+, +, +)
298 G4ThreeVector( 0, 0, 1), G4ThreeVector(-s2, 0, s2), // ( ,-+, +) ( -,-+, +)
299 G4ThreeVector( s2, 0, s2), G4ThreeVector( 0, 0, 1), // ( +,-+, +) (-+,-+, +)
300
301 G4ThreeVector( 0, 0, -1), G4ThreeVector( -1, 0, 0), // ( , ,-+) ( -, ,-+)
302 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +, ,-+) (-+, ,-+)
303 G4ThreeVector( 0, -1, 0), G4ThreeVector(-s2,-s2, 0), // ( , -,-+) ( -, -,-+)
304 G4ThreeVector( s2, -s2, 0), G4ThreeVector( 0, -1, 0), // ( +, -,-+) (-+, -,-+)
305
306 G4ThreeVector( 0, 1, 0), G4ThreeVector( -s2, s2, 0), // ( , +,-+) ( -, +,-+)
307 G4ThreeVector( s2, s2, 0), G4ThreeVector( 0, 1, 0), // ( +, +,-+) (-+, +,-+)
308 G4ThreeVector( 0, -1, 0), G4ThreeVector( -1, 0, 0), // ( ,-+,-+) ( -,-+,-+)
309 G4ThreeVector( 1, 0, 0), G4ThreeVector( -1, 0, 0), // ( +,-+,-+) (-+,-+,-+)
310 };
311
312 G4ThreeVector bmin, bmax;
313 BoundingLimits(bmin, bmax);
314
315 G4double dX = bmax.x() - bmin.x();
316 G4double dY = bmax.y() - bmin.y();
317 G4double dZ = bmax.z() - bmin.z();
318
319 // Define statistics and shell thickness
320 //
321 G4int npoints = (nstat < 1000) ? 1000 : nstat;
322 G4double coeff = 0.5 / std::cbrt(G4double(npoints));
323 G4double eps = (ell > 0) ? ell : coeff * std::min(std::min(dX, dY), dZ);
324 G4double del = 1.8 * eps; // shold be more than sqrt(3.)
325
326 G4double minX = bmin.x() - eps;
327 G4double minY = bmin.y() - eps;
328 G4double minZ = bmin.z() - eps;
329
330 G4double dd = 2. * eps;
331 dX += dd;
332 dY += dd;
333 dZ += dd;
334
335 // Calculate surface area
336 //
337 G4int icount = 0;
338 for(auto i = 0; i < npoints; ++i)
339 {
340 G4double px = minX + dX*G4QuickRand();
341 G4double py = minY + dY*G4QuickRand();
342 G4double pz = minZ + dZ*G4QuickRand();
343 G4ThreeVector p = G4ThreeVector(px, py, pz);
344 EInside in = Inside(p);
345 G4double dist = 0;
346 if (in == kInside)
347 {
348 if (DistanceToOut(p) >= eps) continue;
349 G4int icase = 0;
350 if (Inside(G4ThreeVector(px-del, py, pz)) != kInside) icase += 1;
351 if (Inside(G4ThreeVector(px+del, py, pz)) != kInside) icase += 2;
352 if (Inside(G4ThreeVector(px, py-del, pz)) != kInside) icase += 4;
353 if (Inside(G4ThreeVector(px, py+del, pz)) != kInside) icase += 8;
354 if (Inside(G4ThreeVector(px, py, pz-del)) != kInside) icase += 16;
355 if (Inside(G4ThreeVector(px, py, pz+del)) != kInside) icase += 32;
356 if (icase == 0) continue;
357 G4ThreeVector v = directions[icase];
358 dist = DistanceToOut(p, v);
359 G4ThreeVector n = SurfaceNormal(p + v*dist);
360 dist *= v.dot(n);
361 }
362 else if (in == kOutside)
363 {
364 if (DistanceToIn(p) >= eps) continue;
365 G4int icase = 0;
366 if (Inside(G4ThreeVector(px-del, py, pz)) != kOutside) icase += 1;
367 if (Inside(G4ThreeVector(px+del, py, pz)) != kOutside) icase += 2;
368 if (Inside(G4ThreeVector(px, py-del, pz)) != kOutside) icase += 4;
369 if (Inside(G4ThreeVector(px, py+del, pz)) != kOutside) icase += 8;
370 if (Inside(G4ThreeVector(px, py, pz-del)) != kOutside) icase += 16;
371 if (Inside(G4ThreeVector(px, py, pz+del)) != kOutside) icase += 32;
372 if (icase == 0) continue;
373 G4ThreeVector v = directions[icase];
374 dist = DistanceToIn(p, v);
375 if (dist == kInfinity) continue;
376 G4ThreeVector n = SurfaceNormal(p + v*dist);
377 dist *= -(v.dot(n));
378 }
379 if (dist < eps) ++icount;
380 }
381 return dX*dY*dZ*icount/npoints/dd;
382}
static const G4double eps
double dot(const Hep3Vector &) const
virtual G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=false, G4bool *validNorm=nullptr, G4ThreeVector *n=nullptr) const =0
virtual G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const =0
virtual void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Definition: G4VSolid.cc:665
virtual G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const =0
@ kInside
Definition: geomdefs.hh:70

References G4VSolid::BoundingLimits(), G4VSolid::DistanceToIn(), G4VSolid::DistanceToOut(), CLHEP::Hep3Vector::dot(), eps, G4QuickRand(), G4VSolid::Inside(), kInfinity, kInside, kOutside, G4INCL::Math::min(), CLHEP::detail::n, G4VSolid::SurfaceNormal(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4VSolid::GetSurfaceArea(), G4MultiUnion::GetSurfaceArea(), and G4VCSGfaceted::GetSurfaceArea().

◆ GetAlpha()

G4double G4Para::GetAlpha ( ) const
inline

◆ GetConstituentSolid() [1/2]

G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no)
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 170 of file G4VSolid.cc.

171{ return nullptr; }

◆ GetConstituentSolid() [2/2]

const G4VSolid * G4VSolid::GetConstituentSolid ( G4int  no) const
virtualinherited

Reimplemented in G4BooleanSolid.

Definition at line 167 of file G4VSolid.cc.

168{ return nullptr; }

Referenced by G4BooleanSolid::StackPolyhedron().

◆ GetCubicVolume()

G4double G4Para::GetCubicVolume ( )
virtual

Reimplemented from G4VSolid.

Definition at line 269 of file G4Para.cc.

270{
271 // It is like G4Box, since para transformations keep the volume to be const
272 if (fCubicVolume == 0)
273 {
275 }
276 return fCubicVolume;
277}
G4double fCubicVolume
Definition: G4CSGSolid.hh:70

References G4CSGSolid::fCubicVolume, fDx, fDy, and fDz.

◆ GetDisplacedSolidPtr() [1/2]

G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( )
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 176 of file G4VSolid.cc.

177{ return nullptr; }

◆ GetDisplacedSolidPtr() [2/2]

const G4DisplacedSolid * G4VSolid::GetDisplacedSolidPtr ( ) const
virtualinherited

Reimplemented in G4DisplacedSolid.

Definition at line 173 of file G4VSolid.cc.

174{ return nullptr; }

◆ GetEntityType()

G4GeometryType G4Para::GetEntityType ( ) const
virtual

Implements G4VSolid.

Definition at line 794 of file G4Para.cc.

795{
796 return G4String("G4Para");
797}

◆ GetExtent()

G4VisExtent G4VSolid::GetExtent ( ) const
virtualinherited

Reimplemented in G4Box, G4Orb, G4Sphere, G4Ellipsoid, G4EllipticalCone, G4EllipticalTube, G4GenericTrap, G4Hype, G4TessellatedSolid, G4Tet, G4TwistedTubs, G4VCSGfaceted, and G4VTwistedFaceted.

Definition at line 682 of file G4VSolid.cc.

683{
684 G4VisExtent extent;
685 G4VoxelLimits voxelLimits; // Defaults to "infinite" limits.
686 G4AffineTransform affineTransform;
687 G4double vmin, vmax;
688 CalculateExtent(kXAxis,voxelLimits,affineTransform,vmin,vmax);
689 extent.SetXmin (vmin);
690 extent.SetXmax (vmax);
691 CalculateExtent(kYAxis,voxelLimits,affineTransform,vmin,vmax);
692 extent.SetYmin (vmin);
693 extent.SetYmax (vmax);
694 CalculateExtent(kZAxis,voxelLimits,affineTransform,vmin,vmax);
695 extent.SetZmin (vmin);
696 extent.SetZmax (vmax);
697 return extent;
698}
void SetYmin(G4double ymin)
Definition: G4VisExtent.hh:114
void SetYmax(G4double ymax)
Definition: G4VisExtent.hh:116
void SetXmax(G4double xmax)
Definition: G4VisExtent.hh:112
void SetXmin(G4double xmin)
Definition: G4VisExtent.hh:110
void SetZmax(G4double zmax)
Definition: G4VisExtent.hh:120
void SetZmin(G4double zmin)
Definition: G4VisExtent.hh:118

References G4VSolid::CalculateExtent(), kXAxis, kYAxis, kZAxis, G4VisExtent::SetXmax(), G4VisExtent::SetXmin(), G4VisExtent::SetYmax(), G4VisExtent::SetYmin(), G4VisExtent::SetZmax(), and G4VisExtent::SetZmin().

Referenced by G4tgbVolume::BuildSolidForDivision(), G4BoundingExtentScene::ProcessVolume(), G4BoundingSphereScene::ProcessVolume(), and G4VisCommandsTouchable::SetNewValue().

◆ GetName()

G4String G4VSolid::GetName ( ) const
inlineinherited

Referenced by G4GMocrenFileSceneHandler::AddDetector(), G4HepRepFileSceneHandler::AddHepRepInstance(), G4GMocrenFileSceneHandler::AddPrimitive(), G4HepRepFileSceneHandler::AddSolid(), G4GMocrenFileSceneHandler::AddSolid(), G4VtkSceneHandler::AddSolid(), G4GDMLWriteSolids::AddSolid(), G4NavigationLogger::AlongComputeStepLog(), G4GDMLWriteSolids::BooleanWrite(), G4ReflectedSolid::BoundingLimits(), G4DisplacedSolid::BoundingLimits(), G4IntersectionSolid::BoundingLimits(), G4ScaledSolid::BoundingLimits(), G4SubtractionSolid::BoundingLimits(), G4UnionSolid::BoundingLimits(), G4Box::BoundingLimits(), G4Cons::BoundingLimits(), G4CutTubs::BoundingLimits(), G4Orb::BoundingLimits(), BoundingLimits(), G4Sphere::BoundingLimits(), G4Torus::BoundingLimits(), G4Trap::BoundingLimits(), G4Trd::BoundingLimits(), G4Tubs::BoundingLimits(), G4EllipticalCone::BoundingLimits(), G4ExtrudedSolid::BoundingLimits(), G4GenericPolycone::BoundingLimits(), G4GenericTrap::BoundingLimits(), G4Hype::BoundingLimits(), G4Paraboloid::BoundingLimits(), G4Polycone::BoundingLimits(), G4Polyhedra::BoundingLimits(), G4TessellatedSolid::BoundingLimits(), G4TwistedTubs::BoundingLimits(), G4GDMLWriteSolids::BoxWrite(), G4ExtrudedSolid::CalculateExtent(), G4GenericPolycone::CalculateExtent(), G4Polycone::CalculateExtent(), G4Polyhedra::CalculateExtent(), G4NavigationLogger::CheckDaughterEntryPoint(), G4VDivisionParameterisation::CheckNDivAndWidth(), G4VDivisionParameterisation::CheckOffset(), G4GenericTrap::CheckOrder(), CheckParameters(), G4Trap::CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4ParameterisationPolyconeRho::CheckParametersValidity(), G4ParameterisationPolyconeZ::CheckParametersValidity(), G4ParameterisationPolyhedraRho::CheckParametersValidity(), G4ParameterisationPolyhedraPhi::CheckParametersValidity(), G4ParameterisationPolyhedraZ::CheckParametersValidity(), G4PhantomParameterisation::CheckVoxelsFillContainer(), G4GenericTrap::ComputeIsTwisted(), G4VoxelNavigation::ComputeSafety(), G4VoxelSafety::ComputeSafety(), G4NavigationLogger::ComputeSafetyLog(), G4ParameterisedNavigation::ComputeStep(), G4ReplicaNavigation::ComputeStep(), G4GDMLWriteSolids::ConeWrite(), G4Polyhedra::Create(), G4GenericPolycone::Create(), G4Polycone::Create(), G4PhysicalVolumeModel::CreateCurrentAttValues(), G4ReflectedSolid::CreatePolyhedron(), G4ReflectionFactory::CreateReflectedLV(), G4GenericTrap::CreateTessellatedSolid(), G4GDMLWriteSolids::CutTubeWrite(), G4SolidStore::DeRegister(), G4PhysicalVolumeModel::DescribeSolid(), G4SubtractionSolid::DistanceToIn(), G4Paraboloid::DistanceToIn(), G4TessellatedSolid::DistanceToIn(), G4Box::DistanceToOut(), G4Orb::DistanceToOut(), DistanceToOut(), G4Trap::DistanceToOut(), G4Trd::DistanceToOut(), G4EllipticalCone::DistanceToOut(), G4TessellatedSolid::DistanceToOut(), G4Ellipsoid::DistanceToOut(), G4EllipticalTube::DistanceToOut(), G4tgbGeometryDumper::DumpMultiUnionVolume(), G4tgbGeometryDumper::DumpScaledVolume(), G4tgbGeometryDumper::DumpSolid(), G4GDMLWriteSolids::ElconeWrite(), G4GDMLWriteSolids::EllipsoidWrite(), G4GDMLWriteSolids::EltubeWrite(), G4PVDivision::ErrorInAxis(), G4ReplicatedSlice::ErrorInAxis(), export_G4VSolid(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4Hype::G4Hype(), G4Para(), G4Paraboloid::G4Paraboloid(), G4Polycone::G4Polycone(), G4Polyhedra::G4Polyhedra(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4VParameterisationCons::G4VParameterisationCons(), G4VParameterisationPara::G4VParameterisationPara(), G4VParameterisationPolycone::G4VParameterisationPolycone(), G4VParameterisationPolyhedra::G4VParameterisationPolyhedra(), G4VParameterisationTrd::G4VParameterisationTrd(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GDMLWriteSolids::GenericPolyconeWrite(), G4GDMLWriteSolids::GenTrapWrite(), G4Navigator::GetGlobalExitNormal(), G4Navigator::GetLocalExitNormal(), G4ITNavigator1::GetLocalExitNormal(), G4ITNavigator2::GetLocalExitNormal(), G4BooleanSolid::GetPointOnSurface(), G4PhantomParameterisation::GetReplicaNo(), G4GDMLWriteSolids::HypeWrite(), G4TessellatedSolid::InsideNoVoxels(), G4TessellatedSolid::InsideVoxels(), G4ITNavigator1::LocateGlobalPointAndSetup(), G4ITNavigator2::LocateGlobalPointAndSetup(), G4Navigator::LocateGlobalPointAndSetup(), G4GenericTrap::MakeDownFacet(), G4Trap::MakePlanes(), G4GenericTrap::MakeUpFacet(), G4GDMLWriteSolids::MultiUnionWrite(), G4GDMLWriteSolids::OrbWrite(), G4GDMLWriteSolids::ParaboloidWrite(), G4GDMLWriteParamvol::ParametersWrite(), G4GDMLWriteSolids::ParaWrite(), G4GDMLWriteSolids::PolyconeWrite(), G4GDMLWriteSolids::PolyhedraWrite(), G4NavigationLogger::PostComputeStepLog(), G4NavigationLogger::PreComputeStepLog(), G4NavigationLogger::PrintDaughterLog(), G4PseudoScene::ProcessVolume(), G4SolidStore::Register(), G4tgbVolumeMgr::RegisterMe(), G4NavigationLogger::ReportOutsideMother(), G4ASCIITreeSceneHandler::RequestPrimitives(), G4VSceneHandler::RequestPrimitives(), G4GenericPolycone::Reset(), G4Polyhedra::Reset(), G4VoxelSafety::SafetyForVoxelNode(), G4GDMLWriteSolids::ScaledWrite(), G4Torus::SetAllParameters(), G4Tet::SetBoundingLimits(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4TessellatedSolid::SetSolidClosed(), G4Tet::SetVertices(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4GDMLWriteSolids::SphereWrite(), G4BooleanSolid::StackPolyhedron(), G4ReflectedSolid::StreamInfo(), G4BooleanSolid::StreamInfo(), G4DisplacedSolid::StreamInfo(), G4MultiUnion::StreamInfo(), G4ScaledSolid::StreamInfo(), G4Box::StreamInfo(), G4Cons::StreamInfo(), G4CSGSolid::StreamInfo(), G4CutTubs::StreamInfo(), G4Orb::StreamInfo(), StreamInfo(), G4Sphere::StreamInfo(), G4Torus::StreamInfo(), G4Trap::StreamInfo(), G4Trd::StreamInfo(), G4Tubs::StreamInfo(), G4Ellipsoid::StreamInfo(), G4EllipticalCone::StreamInfo(), G4EllipticalTube::StreamInfo(), G4ExtrudedSolid::StreamInfo(), G4GenericPolycone::StreamInfo(), G4GenericTrap::StreamInfo(), G4Hype::StreamInfo(), G4Paraboloid::StreamInfo(), G4Polycone::StreamInfo(), G4Polyhedra::StreamInfo(), G4TessellatedSolid::StreamInfo(), G4Tet::StreamInfo(), G4TwistedBox::StreamInfo(), G4TwistedTrap::StreamInfo(), G4TwistedTrd::StreamInfo(), G4TwistedTubs::StreamInfo(), G4VCSGfaceted::StreamInfo(), G4VTwistedFaceted::StreamInfo(), G4GDMLRead::StripNames(), SubstractSolids(), G4UnionSolid::SurfaceNormal(), G4Box::SurfaceNormal(), SurfaceNormal(), G4Trap::SurfaceNormal(), G4Trd::SurfaceNormal(), G4Ellipsoid::SurfaceNormal(), G4EllipticalCone::SurfaceNormal(), G4EllipticalTube::SurfaceNormal(), G4ExtrudedSolid::SurfaceNormal(), G4Tet::SurfaceNormal(), G4GDMLWriteSolids::TessellatedWrite(), G4GDMLWriteSolids::TetWrite(), G4GDMLWriteSolids::TorusWrite(), G4GDMLWriteSolids::TrapWrite(), G4GDMLWriteStructure::TraverseVolumeTree(), G4GDMLWriteSolids::TrdWrite(), G4GDMLWriteSolids::TubeWrite(), G4GDMLWriteSolids::TwistedboxWrite(), G4GDMLWriteSolids::TwistedtrapWrite(), G4GDMLWriteSolids::TwistedtrdWrite(), G4GDMLWriteSolids::TwistedtubsWrite(), G4PhysicalVolumeModel::VisitGeometryAndGetVisReps(), and G4GDMLWriteSolids::XtruWrite().

◆ GetPhi()

G4double G4Para::GetPhi ( ) const
inline

◆ GetPointOnSurface()

G4ThreeVector G4Para::GetPointOnSurface ( ) const
virtual

Reimplemented from G4VSolid.

Definition at line 841 of file G4Para.cc.

842{
843 G4double DyTalpha = fDy*fTalpha;
844 G4double DzTthetaSphi = fDz*fTthetaSphi;
845 G4double DzTthetaCphi = fDz*fTthetaCphi;
846
847 // Set vertices
848 //
849 G4ThreeVector pt[8];
850 pt[0].set(-DzTthetaCphi-DyTalpha-fDx, -DzTthetaSphi-fDy, -fDz);
851 pt[1].set(-DzTthetaCphi-DyTalpha+fDx, -DzTthetaSphi-fDy, -fDz);
852 pt[2].set(-DzTthetaCphi+DyTalpha-fDx, -DzTthetaSphi+fDy, -fDz);
853 pt[3].set(-DzTthetaCphi+DyTalpha+fDx, -DzTthetaSphi+fDy, -fDz);
854 pt[4].set( DzTthetaCphi-DyTalpha-fDx, DzTthetaSphi-fDy, fDz);
855 pt[5].set( DzTthetaCphi-DyTalpha+fDx, DzTthetaSphi-fDy, fDz);
856 pt[6].set( DzTthetaCphi+DyTalpha-fDx, DzTthetaSphi+fDy, fDz);
857 pt[7].set( DzTthetaCphi+DyTalpha+fDx, DzTthetaSphi+fDy, fDz);
858
859 // Set areas (-Z, -Y, +Y, -X, +X, +Z)
860 //
861 G4ThreeVector vx(fDx, 0, 0);
862 G4ThreeVector vy(DyTalpha, fDy, 0);
863 G4ThreeVector vz(DzTthetaCphi, DzTthetaSphi, fDz);
864
865 G4double sxy = fDx*fDy; // (vx.cross(vy)).mag();
866 G4double sxz = (vx.cross(vz)).mag();
867 G4double syz = (vy.cross(vz)).mag();
868
869 G4double sface[6] = { sxy, syz, syz, sxz, sxz, sxy };
870 for (G4int i=1; i<6; ++i) { sface[i] += sface[i-1]; }
871
872 // Select face
873 //
874 G4double select = sface[5]*G4UniformRand();
875 G4int k = 5;
876 if (select <= sface[4]) k = 4;
877 if (select <= sface[3]) k = 3;
878 if (select <= sface[2]) k = 2;
879 if (select <= sface[1]) k = 1;
880 if (select <= sface[0]) k = 0;
881
882 // Generate point
883 //
884 G4int ip[6][3] = {{0,1,2}, {0,4,1}, {2,3,6}, {0,2,4}, {1,5,3}, {4,6,5}};
887 return (1.-u-v)*pt[ip[k][0]] + u*pt[ip[k][1]] + v*pt[ip[k][2]];
888}
#define G4UniformRand()
Definition: Randomize.hh:52

References CLHEP::Hep3Vector::cross(), fDx, fDy, fDz, fTalpha, fTthetaCphi, fTthetaSphi, G4UniformRand, and CLHEP::Hep3Vector::set().

◆ GetPolyhedron()

G4Polyhedron * G4CSGSolid::GetPolyhedron ( ) const
virtualinherited

◆ GetRadiusInRing()

G4double G4CSGSolid::GetRadiusInRing ( G4double  rmin,
G4double  rmax 
) const
protectedinherited

Definition at line 109 of file G4CSGSolid.cc.

110{
111 G4double k = G4QuickRand();
112 return (rmin <= 0) ? rmax*std::sqrt(k)
113 : std::sqrt(k*rmax*rmax + (1. - k)*rmin*rmin);
114}

References G4QuickRand().

Referenced by G4Cons::GetPointOnSurface(), and G4Torus::GetPointOnSurface().

◆ GetSurfaceArea()

G4double G4Para::GetSurfaceArea ( )
virtual

Reimplemented from G4VSolid.

Definition at line 283 of file G4Para.cc.

284{
285 if(fSurfaceArea == 0)
286 {
287 G4ThreeVector vx(fDx, 0, 0);
290
291 G4double sxy = fDx*fDy; // (vx.cross(vy)).mag();
292 G4double sxz = (vx.cross(vz)).mag();
293 G4double syz = (vy.cross(vz)).mag();
294
295 fSurfaceArea = 8*(sxy+sxz+syz);
296 }
297 return fSurfaceArea;
298}
G4double fSurfaceArea
Definition: G4CSGSolid.hh:71

References CLHEP::Hep3Vector::cross(), fDx, fDy, fDz, G4CSGSolid::fSurfaceArea, fTalpha, fTthetaCphi, and fTthetaSphi.

◆ GetSymAxis()

G4ThreeVector G4Para::GetSymAxis ( ) const
inline

◆ GetTanAlpha()

G4double G4Para::GetTanAlpha ( ) const
inline

◆ GetTheta()

G4double G4Para::GetTheta ( ) const
inline

◆ GetTolerance()

G4double G4VSolid::GetTolerance ( ) const
inlineinherited

◆ GetXHalfLength()

G4double G4Para::GetXHalfLength ( ) const
inline

◆ GetYHalfLength()

G4double G4Para::GetYHalfLength ( ) const
inline

◆ GetZHalfLength()

G4double G4Para::GetZHalfLength ( ) const
inline

◆ Inside()

EInside G4Para::Inside ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 414 of file G4Para.cc.

415{
416 G4double xx = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()+fPlanes[2].c*p.z();
417 G4double dx = std::abs(xx) + fPlanes[2].d;
418
419 G4double yy = fPlanes[0].b*p.y()+fPlanes[0].c*p.z();
420 G4double dy = std::abs(yy) + fPlanes[0].d;
421 G4double dxy = std::max(dx,dy);
422
423 G4double dz = std::abs(p.z())-fDz;
424 G4double dist = std::max(dxy,dz);
425
426 if (dist > halfCarTolerance) return kOutside;
427 return (dist > -halfCarTolerance) ? kSurface : kInside;
428}
@ kSurface
Definition: geomdefs.hh:69

References fDz, fPlanes, halfCarTolerance, kInside, kOutside, kSurface, G4INCL::Math::max(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by DistanceToOut().

◆ MakePlanes()

void G4Para::MakePlanes ( )
private

Definition at line 230 of file G4Para.cc.

231{
232 G4ThreeVector vx(1, 0, 0);
233 G4ThreeVector vy(fTalpha, 1, 0);
235
236 // Set -Y & +Y planes
237 //
238 G4ThreeVector ynorm = (vx.cross(vz)).unit();
239
240 fPlanes[0].a = 0.;
241 fPlanes[0].b = ynorm.y();
242 fPlanes[0].c = ynorm.z();
243 fPlanes[0].d = fPlanes[0].b*fDy; // point (0,fDy,0) is on plane
244
245 fPlanes[1].a = 0.;
246 fPlanes[1].b = -fPlanes[0].b;
247 fPlanes[1].c = -fPlanes[0].c;
248 fPlanes[1].d = fPlanes[0].d;
249
250 // Set -X & +X planes
251 //
252 G4ThreeVector xnorm = (vz.cross(vy)).unit();
253
254 fPlanes[2].a = xnorm.x();
255 fPlanes[2].b = xnorm.y();
256 fPlanes[2].c = xnorm.z();
257 fPlanes[2].d = fPlanes[2].a*fDx; // point (fDx,0,0) is on plane
258
259 fPlanes[3].a = -fPlanes[2].a;
260 fPlanes[3].b = -fPlanes[2].b;
261 fPlanes[3].c = -fPlanes[2].c;
262 fPlanes[3].d = fPlanes[2].d;
263}

References CLHEP::Hep3Vector::cross(), fDx, fDy, fPlanes, fTalpha, fTthetaCphi, fTthetaSphi, CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Referenced by G4Para(), and SetAllParameters().

◆ operator=()

G4Para & G4Para::operator= ( const G4Para rhs)

Definition at line 157 of file G4Para.cc.

158{
159 // Check assignment to self
160 //
161 if (this == &rhs) { return *this; }
162
163 // Copy base class data
164 //
166
167 // Copy data
168 //
170 fDx = rhs.fDx;
171 fDy = rhs.fDy;
172 fDz = rhs.fDz;
173 fTalpha = rhs.fTalpha;
176 for (G4int i=0; i<4; ++i) { fPlanes[i] = rhs.fPlanes[i]; }
177
178 return *this;
179}
G4CSGSolid & operator=(const G4CSGSolid &rhs)
Definition: G4CSGSolid.cc:89

References fDx, fDy, fDz, fPlanes, fTalpha, fTthetaCphi, fTthetaSphi, halfCarTolerance, and G4CSGSolid::operator=().

◆ operator==()

G4bool G4VSolid::operator== ( const G4VSolid s) const
inlineinherited

◆ SetAllParameters()

void G4Para::SetAllParameters ( G4double  pDx,
G4double  pDy,
G4double  pDz,
G4double  pAlpha,
G4double  pTheta,
G4double  pPhi 
)

Definition at line 185 of file G4Para.cc.

187{
188 // Reset data of the base class
189 fCubicVolume = 0;
190 fSurfaceArea = 0;
191 fRebuildPolyhedron = true;
192
193 // Set parameters
194 fDx = pDx;
195 fDy = pDy;
196 fDz = pDz;
197 fTalpha = std::tan(pAlpha);
198 fTthetaCphi = std::tan(pTheta)*std::cos(pPhi);
199 fTthetaSphi = std::tan(pTheta)*std::sin(pPhi);
200
202 MakePlanes();
203}

References CheckParameters(), G4CSGSolid::fCubicVolume, fDx, fDy, fDz, G4CSGSolid::fRebuildPolyhedron, G4CSGSolid::fSurfaceArea, fTalpha, fTthetaCphi, fTthetaSphi, and MakePlanes().

Referenced by G4ParameterisationParaX::ComputeDimensions(), G4ParameterisationParaY::ComputeDimensions(), G4ParameterisationParaZ::ComputeDimensions(), export_G4Para(), and G4Para().

◆ SetAlpha()

void G4Para::SetAlpha ( G4double  alpha)
inline

◆ SetName()

void G4VSolid::SetName ( const G4String name)
inherited

Definition at line 127 of file G4VSolid.cc.

128{
131}
void SetMapValid(G4bool val)
Definition: G4SolidStore.hh:76
static G4SolidStore * GetInstance()
G4String fshapeName
Definition: G4VSolid.hh:312
const char * name(G4int ptype)

References G4VSolid::fshapeName, G4SolidStore::GetInstance(), G4InuclParticleNames::name(), and G4SolidStore::SetMapValid().

Referenced by export_G4VSolid(), G4MultiUnion::G4MultiUnion(), and G4GDMLRead::StripNames().

◆ SetTanAlpha()

void G4Para::SetTanAlpha ( G4double  val)
inline

◆ SetThetaAndPhi()

void G4Para::SetThetaAndPhi ( double  pTheta,
double  pPhi 
)
inline

◆ SetXHalfLength()

void G4Para::SetXHalfLength ( G4double  val)
inline

◆ SetYHalfLength()

void G4Para::SetYHalfLength ( G4double  val)
inline

◆ SetZHalfLength()

void G4Para::SetZHalfLength ( G4double  val)
inline

◆ StreamInfo()

std::ostream & G4Para::StreamInfo ( std::ostream &  os) const
virtual

Reimplemented from G4CSGSolid.

Definition at line 812 of file G4Para.cc.

813{
814 G4double alpha = std::atan(fTalpha);
815 G4double theta = std::atan(std::sqrt(fTthetaCphi*fTthetaCphi +
817 G4double phi = std::atan2(fTthetaSphi,fTthetaCphi);
818
819 G4int oldprc = os.precision(16);
820 os << "-----------------------------------------------------------\n"
821 << " *** Dump for solid - " << GetName() << " ***\n"
822 << " ===================================================\n"
823 << " Solid type: G4Para\n"
824 << " Parameters:\n"
825 << " half length X: " << fDx/mm << " mm\n"
826 << " half length Y: " << fDy/mm << " mm\n"
827 << " half length Z: " << fDz/mm << " mm\n"
828 << " alpha: " << alpha/degree << "degrees\n"
829 << " theta: " << theta/degree << "degrees\n"
830 << " phi: " << phi/degree << "degrees\n"
831 << "-----------------------------------------------------------\n";
832 os.precision(oldprc);
833
834 return os;
835}
static constexpr double degree
Definition: G4SIunits.hh:124

References alpha, degree, fDx, fDy, fDz, fTalpha, fTthetaCphi, fTthetaSphi, G4VSolid::GetName(), and mm.

◆ SurfaceNormal()

G4ThreeVector G4Para::SurfaceNormal ( const G4ThreeVector p) const
virtual

Implements G4VSolid.

Definition at line 434 of file G4Para.cc.

435{
436 G4int nsurf = 0; // number of surfaces where p is placed
437
438 // Check Z faces
439 //
440 G4double nz = 0;
441 G4double dz = std::abs(p.z()) - fDz;
442 if (std::abs(dz) <= halfCarTolerance)
443 {
444 nz = (p.z() < 0) ? -1 : 1;
445 ++nsurf;
446 }
447
448 // Check Y faces
449 //
450 G4double ny = 0;
451 G4double yy = fPlanes[0].b*p.y()+fPlanes[0].c*p.z();
452 if (std::abs(fPlanes[0].d + yy) <= halfCarTolerance)
453 {
454 ny = fPlanes[0].b;
455 nz += fPlanes[0].c;
456 ++nsurf;
457 }
458 else if (std::abs(fPlanes[1].d - yy) <= halfCarTolerance)
459 {
460 ny = fPlanes[1].b;
461 nz += fPlanes[1].c;
462 ++nsurf;
463 }
464
465 // Check X faces
466 //
467 G4double nx = 0;
468 G4double xx = fPlanes[2].a*p.x()+fPlanes[2].b*p.y()+fPlanes[2].c*p.z();
469 if (std::abs(fPlanes[2].d + xx) <= halfCarTolerance)
470 {
471 nx = fPlanes[2].a;
472 ny += fPlanes[2].b;
473 nz += fPlanes[2].c;
474 ++nsurf;
475 }
476 else if (std::abs(fPlanes[3].d - xx) <= halfCarTolerance)
477 {
478 nx = fPlanes[3].a;
479 ny += fPlanes[3].b;
480 nz += fPlanes[3].c;
481 ++nsurf;
482 }
483
484 // Return normal
485 //
486 if (nsurf == 1) return G4ThreeVector(nx,ny,nz);
487 else if (nsurf != 0) return G4ThreeVector(nx,ny,nz).unit(); // edge or corner
488 else
489 {
490 // Point is not on the surface
491 //
492#ifdef G4CSGDEBUG
493 std::ostringstream message;
494 G4int oldprc = message.precision(16);
495 message << "Point p is not on surface (!?) of solid: "
496 << GetName() << G4endl;
497 message << "Position:\n";
498 message << " p.x() = " << p.x()/mm << " mm\n";
499 message << " p.y() = " << p.y()/mm << " mm\n";
500 message << " p.z() = " << p.z()/mm << " mm";
501 G4cout.precision(oldprc) ;
502 G4Exception("G4Para::SurfaceNormal(p)", "GeomSolids1002",
503 JustWarning, message );
504 DumpInfo();
505#endif
506 return ApproxSurfaceNormal(p);
507 }
508}
Hep3Vector unit() const
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
Definition: G4Para.cc:515

References ApproxSurfaceNormal(), d, G4VSolid::DumpInfo(), fDz, fPlanes, G4cout, G4endl, G4Exception(), G4VSolid::GetName(), halfCarTolerance, JustWarning, mm, CLHEP::Hep3Vector::unit(), CLHEP::Hep3Vector::x(), CLHEP::Hep3Vector::y(), and CLHEP::Hep3Vector::z().

Field Documentation

◆ a

G4double G4Para::a

Definition at line 188 of file G4Para.hh.

Referenced by ApproxSurfaceNormal(), and DistanceToOut().

◆ b

G4double G4Para::b

Definition at line 188 of file G4Para.hh.

Referenced by ApproxSurfaceNormal(), and DistanceToOut().

◆ c

G4double G4Para::c

Definition at line 188 of file G4Para.hh.

Referenced by ApproxSurfaceNormal(), and DistanceToOut().

◆ d

G4double G4Para::d

Definition at line 188 of file G4Para.hh.

Referenced by ApproxSurfaceNormal(), and SurfaceNormal().

◆ fCubicVolume

G4double G4CSGSolid::fCubicVolume = 0.0
protectedinherited

◆ fDx

G4double G4Para::fDx
private

◆ fDy

G4double G4Para::fDy
private

◆ fDz

G4double G4Para::fDz
private

◆ 

struct { ... } G4Para::fPlanes[4]

◆ fpPolyhedron

G4Polyhedron* G4CSGSolid::fpPolyhedron = nullptr
mutableprotectedinherited

◆ fRebuildPolyhedron

G4bool G4CSGSolid::fRebuildPolyhedron = false
mutableprotectedinherited

◆ fshapeName

G4String G4VSolid::fshapeName
privateinherited

Definition at line 312 of file G4VSolid.hh.

Referenced by G4VSolid::operator=(), and G4VSolid::SetName().

◆ fSurfaceArea

G4double G4CSGSolid::fSurfaceArea = 0.0
protectedinherited

◆ fTalpha

G4double G4Para::fTalpha
private

◆ fTthetaCphi

G4double G4Para::fTthetaCphi
private

◆ fTthetaSphi

G4double G4Para::fTthetaSphi
private

◆ halfCarTolerance

G4double G4Para::halfCarTolerance
private

Definition at line 185 of file G4Para.hh.

Referenced by DistanceToIn(), DistanceToOut(), Inside(), operator=(), and SurfaceNormal().

◆ kCarTolerance

G4double G4VSolid::kCarTolerance
protectedinherited

Definition at line 299 of file G4VSolid.hh.

Referenced by G4TessellatedSolid::AddFacet(), G4Polycone::CalculateExtent(), G4Polyhedra::CalculateExtent(), G4Tet::CheckDegeneracy(), CheckParameters(), G4Trd::CheckParameters(), G4Ellipsoid::CheckParameters(), G4EllipticalTube::CheckParameters(), G4GenericTrap::ComputeIsTwisted(), G4Polyhedra::Create(), G4GenericPolycone::Create(), G4Polycone::Create(), G4CutTubs::CreatePolyhedron(), G4TessellatedSolid::CreateVertexList(), G4VCSGfaceted::DistanceTo(), G4Sphere::DistanceToIn(), G4Ellipsoid::DistanceToIn(), G4Hype::DistanceToIn(), G4Paraboloid::DistanceToIn(), G4VCSGfaceted::DistanceToIn(), G4TessellatedSolid::DistanceToInCore(), G4Cons::DistanceToOut(), G4CutTubs::DistanceToOut(), G4Sphere::DistanceToOut(), G4Torus::DistanceToOut(), G4Tubs::DistanceToOut(), G4GenericTrap::DistanceToOut(), G4Hype::DistanceToOut(), G4Paraboloid::DistanceToOut(), G4VCSGfaceted::DistanceToOut(), G4TessellatedSolid::DistanceToOutCandidates(), G4TessellatedSolid::DistanceToOutCore(), G4TessellatedSolid::DistanceToOutNoVoxels(), G4GenericTrap::DistToPlane(), G4GenericTrap::DistToTriangle(), G4Box::G4Box(), G4Cons::G4Cons(), G4CutTubs::G4CutTubs(), G4EllipticalCone::G4EllipticalCone(), G4ExtrudedSolid::G4ExtrudedSolid(), G4GenericTrap::G4GenericTrap(), G4Hype::G4Hype(), G4Para(), G4Sphere::G4Sphere(), G4Tet::G4Tet(), G4Trap::G4Trap(), G4Tubs::G4Tubs(), G4UnionSolid::G4UnionSolid(), G4VSolid::G4VSolid(), G4VTwistedFaceted::G4VTwistedFaceted(), G4GenericPolycone::GetPointOnSurface(), G4Polycone::GetPointOnSurface(), G4UnionSolid::Init(), G4Orb::Initialize(), G4TessellatedSolid::Initialize(), G4SubtractionSolid::Inside(), G4Hype::Inside(), G4Paraboloid::Inside(), G4VCSGfaceted::Inside(), G4VTwistedFaceted::Inside(), G4TessellatedSolid::InsideNoVoxels(), G4GenericTrap::InsidePolygone(), G4TessellatedSolid::InsideVoxels(), G4CutTubs::IsCrossingCutPlanes(), G4GenericTrap::IsSegCrossingZ(), G4Trap::MakePlane(), G4GenericTrap::NormalToPlane(), G4VSolid::operator=(), G4TessellatedSolid::SafetyFromInside(), G4TessellatedSolid::SafetyFromOutside(), G4Torus::SetAllParameters(), G4Polycone::SetOriginalParameters(), G4Polyhedra::SetOriginalParameters(), G4Box::SetXHalfLength(), G4Box::SetYHalfLength(), G4Box::SetZHalfLength(), G4Torus::SurfaceNormal(), G4GenericTrap::SurfaceNormal(), and G4Paraboloid::SurfaceNormal().


The documentation for this class was generated from the following files: