51 #if !defined(G4GEOM_USE_UPARA)
62 using namespace CLHEP;
87 fDx = (pt[3].
x() - pt[2].
x())*0.5;
88 fDy = (pt[2].
y() - pt[1].
y())*0.5;
92 fTalpha = (pt[2].
x() + pt[3].
x() - pt[1].
x() - pt[0].
x())*0.25/
fDy;
103 v[0].
set(-DzTthetaCphi-DyTalpha-
fDx, -DzTthetaSphi-
fDy, -
fDz);
104 v[1].
set(-DzTthetaCphi-DyTalpha+
fDx, -DzTthetaSphi-
fDy, -
fDz);
105 v[2].
set(-DzTthetaCphi+DyTalpha-
fDx, -DzTthetaSphi+
fDy, -
fDz);
106 v[3].
set(-DzTthetaCphi+DyTalpha+
fDx, -DzTthetaSphi+
fDy, -
fDz);
107 v[4].
set( DzTthetaCphi-DyTalpha-
fDx, DzTthetaSphi-
fDy,
fDz);
108 v[5].
set( DzTthetaCphi-DyTalpha+
fDx, DzTthetaSphi-
fDy,
fDz);
109 v[6].
set( DzTthetaCphi+DyTalpha-
fDx, DzTthetaSphi+
fDy,
fDz);
110 v[7].
set( DzTthetaCphi+DyTalpha+
fDx, DzTthetaSphi+
fDy,
fDz);
114 for (
G4int i=0; i<8; ++i)
116 G4double delx = std::abs(pt[i].
x() - v[i].
x());
117 G4double dely = std::abs(pt[i].
y() - v[i].
y());
118 G4double delz = std::abs(pt[i].
z() - v[i].
z());
123 G4int oldprc = message.precision(16);
124 message <<
"Invalid vertice coordinates for Solid: " <<
GetName()
125 <<
"\nVertix #" << i <<
", discrepancy = " << discrepancy
126 <<
"\n original : " << pt[i]
127 <<
"\n recomputed : " << v[i];
161 :
G4CSGSolid(rhs), halfCarTolerance(rhs.halfCarTolerance),
162 fDx(rhs.fDx), fDy(rhs.fDy), fDz(rhs.fDz), fTalpha(rhs.fTalpha),
163 fTthetaCphi(rhs.fTthetaCphi),fTthetaSphi(rhs.fTthetaSphi)
176 if (
this == &rhs) {
return *
this; }
231 message <<
"Invalid (too small or negative) dimensions for Solid: "
236 G4Exception(
"G4Para::CheckParameters()",
"GeomSolids0002",
342 std::min(-x0-x1-dx,-x0+x1-dx),x0-x1-dx),x0+x1-dx);
346 std::max(-x0-x1+dx,-x0+x1+dx),x0-x1+dx),x0+x1+dx);
352 pMin.
set(xmin,ymin,-dz);
353 pMax.
set(xmax,ymax, dz);
357 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
360 message <<
"Bad bounding box (min >= max) for solid: "
362 <<
"\npMin = " << pMin
363 <<
"\npMax = " << pMax;
364 G4Exception(
"G4Para::BoundingLimits()",
"GeomMgt0001",
387 if (
true)
return bbox.
CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
391 return exist = (pMin < pMax) ?
true :
false;
405 baseA[0].set(-x0-x1-dx,-y0-dy,-dz);
406 baseA[1].set(-x0-x1+dx,-y0-dy,-dz);
407 baseA[2].set(-x0+x1+dx,-y0+dy,-dz);
408 baseA[3].set(-x0+x1-dx,-y0+dy,-dz);
410 baseB[0].set(+x0-x1-dx, y0-dy, dz);
411 baseB[1].set(+x0-x1+dx, y0-dy, dz);
412 baseB[2].set(+x0+x1+dx, y0+dy, dz);
413 baseB[3].set(+x0+x1-dx, y0+dy, dz);
415 std::vector<const G4ThreeVectorList *> polygons(2);
416 polygons[0] = &baseA;
417 polygons[1] = &baseB;
459 nz = (p.
z() < 0) ? -1 : 1;
509 G4int oldprc = message.precision(16);
510 message <<
"Point p is not on surface (!?) of solid: "
512 message <<
"Position:\n";
513 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
514 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
515 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
516 G4cout.precision(oldprc) ;
517 G4Exception(
"G4Para::SurfaceNormal(p)",
"GeomSolids1002",
534 for (
G4int i=0; i<4; ++i)
539 if (d > dist) { dist =
d; iside = i; }
568 G4double tmin0 = tzmin, tmax0 = tzmax;
576 if (tmin0 < tmp) tmin0 =
tmp;
581 if (tmax0 > tmp) tmax0 =
tmp;
584 G4double tmin1 = tmin0, tmax1 = tmax0;
591 if (tmin1 < tmp) tmin1 =
tmp;
596 if (tmax1 > tmp) tmax1 =
tmp;
601 G4double tmin2 = tmin1, tmax2 = tmax1;
609 if (tmin2 < tmp) tmin2 =
tmp;
614 if (tmax2 > tmp) tmax2 =
tmp;
617 G4double tmin3 = tmin2, tmax3 = tmax2;
624 if (tmin3 < tmp) tmin3 =
tmp;
629 if (tmax3 > tmp) tmax3 =
tmp;
634 G4double tmin = tmin3, tmax = tmax3;
656 return (dist > 0) ? dist : 0.;
676 n->
set(0, 0, (p.
z() < 0) ? -1 : 1);
682 G4int iside = (vz < 0) ? -4 : -2;
700 if (tmax > tmp) { tmax =
tmp; iside = 0; }
717 if (tmax > tmp) { tmax =
tmp; iside = 1; }
736 if (tmax > tmp) { tmax =
tmp; iside = 2; }
753 if (tmax > tmp) { tmax =
tmp; iside = 3; }
762 n->
set(0, 0, iside + 3);
780 G4int oldprc = message.precision(16);
781 message <<
"Point p is outside (!?) of solid: " <<
GetName() <<
G4endl;
782 message <<
"Position:\n";
783 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
784 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
785 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
786 G4cout.precision(oldprc) ;
787 G4Exception(
"G4Para::DistanceToOut(p)",
"GeomSolids1002",
802 return (dist < 0) ? -dist : 0.;
835 G4int oldprc = os.precision(16);
836 os <<
"-----------------------------------------------------------\n"
837 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
838 <<
" ===================================================\n"
839 <<
" Solid type: G4Para\n"
841 <<
" half length X: " <<
fDx/
mm <<
" mm\n"
842 <<
" half length Y: " <<
fDy/
mm <<
" mm\n"
843 <<
" half length Z: " <<
fDz/
mm <<
" mm\n"
844 <<
" alpha: " << alpha/
degree << signDegree <<
"\n"
845 <<
" theta: " << theta/
degree << signDegree <<
"\n"
846 <<
" phi: " << phi/
degree << signDegree <<
"\n"
847 <<
"-----------------------------------------------------------\n";
848 os.precision(oldprc);
866 pt[0].
set(-DzTthetaCphi-DyTalpha-
fDx, -DzTthetaSphi-
fDy, -
fDz);
867 pt[1].
set(-DzTthetaCphi-DyTalpha+
fDx, -DzTthetaSphi-
fDy, -
fDz);
868 pt[2].
set(-DzTthetaCphi+DyTalpha-
fDx, -DzTthetaSphi+
fDy, -
fDz);
869 pt[3].
set(-DzTthetaCphi+DyTalpha+
fDx, -DzTthetaSphi+
fDy, -
fDz);
870 pt[4].
set( DzTthetaCphi-DyTalpha-
fDx, DzTthetaSphi-
fDy,
fDz);
871 pt[5].
set( DzTthetaCphi-DyTalpha+
fDx, DzTthetaSphi-
fDy,
fDz);
872 pt[6].
set( DzTthetaCphi+DyTalpha-
fDx, DzTthetaSphi+
fDy,
fDz);
873 pt[7].
set( DzTthetaCphi+DyTalpha+
fDx, DzTthetaSphi+
fDy,
fDz);
885 G4double sface[6] = { sxy, syz, syz, sxz, sxz, sxy };
886 for (
G4int i=1; i<6; ++i) { sface[i] += sface[i-1]; }
892 if (select <= sface[4]) k = 4;
893 if (select <= sface[3]) k = 3;
894 if (select <= sface[2]) k = 2;
895 if (select <= sface[1]) k = 1;
896 if (select <= sface[0]) k = 0;
900 G4int ip[6][3] = {{0,1,2}, {0,4,1}, {2,3,6}, {0,2,4}, {1,5,3}, {4,6,5}};
903 return (1.-u-v)*pt[ip[k][0]] + u*pt[ip[k][1]] + v*pt[ip[k][2]];
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
void set(double x, double y, double z)
T max(const T t1, const T t2)
brief Return the largest of the two arguments
G4ThreeVector GetPointOnSurface() const
CLHEP::Hep3Vector G4ThreeVector
std::vector< ExP01TrackerHit * > a
G4double DistanceToOut(const G4ThreeVector &p, const G4ThreeVector &v, const G4bool calcNorm=G4bool(false), G4bool *validNorm=0, G4ThreeVector *n=0) const
virtual void AddSolid(const G4Box &)=0
static const G4double kInfinity
G4double GetTanAlpha() const
struct G4Para::@33 fPlanes[4]
G4ThreeVector SurfaceNormal(const G4ThreeVector &p) const
static constexpr double mm
Float_t x1[n_points_granero]
G4CSGSolid & operator=(const G4CSGSolid &rhs)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
void message(RunManager *runmanager)
G4ThreeVector ApproxSurfaceNormal(const G4ThreeVector &p) const
G4double GetCubicVolume()
G4double GetXHalfLength() const
const G4double kCarTolerance
void SetAllParameters(G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)
std::ostream & StreamInfo(std::ostream &os) const
G4bool BoundingBoxVsVoxelLimits(const EAxis pAxis, const G4VoxelLimits &pVoxelLimits, const G4Transform3D &pTransform3D, G4double &pMin, G4double &pMax) const
G4double DistanceToIn(const G4ThreeVector &p, const G4ThreeVector &v) const
std::vector< G4ThreeVector > G4ThreeVectorList
G4double halfCarTolerance
G4bool CalculateExtent(const EAxis pAxis, const G4VoxelLimits &pVoxelLimit, const G4AffineTransform &pTransform, G4double &pMin, G4double &pMax) const
static const G4double alpha
void BoundingLimits(G4ThreeVector &pMin, G4ThreeVector &pMax) const
Hep3Vector cross(const Hep3Vector &) const
void ComputeDimensions(G4VPVParameterisation *p, const G4int n, const G4VPhysicalVolume *pRep)
G4GeometryType GetEntityType() const
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4double GetSurfaceArea()
EInside Inside(const G4ThreeVector &p) const
static constexpr double degree
G4Polyhedron * CreatePolyhedron() const
G4GLOB_DLL std::ostream G4cout
G4Para & operator=(const G4Para &rhs)
void DescribeYourselfTo(G4VGraphicsScene &scene) const
G4double GetZHalfLength() const
G4bool fRebuildPolyhedron
T min(const T t1, const T t2)
brief Return the smallest of the two arguments
G4double GetYHalfLength() const
G4Para(const G4String &pName, G4double pDx, G4double pDy, G4double pDz, G4double pAlpha, G4double pTheta, G4double pPhi)