35 #if !defined(G4GEOM_USE_UTRD)
48 using namespace CLHEP;
59 fDx1(pdx1), fDx2(pdx2), fDy1(pdy1), fDy2(pdy2), fDz(pdz)
72 fDx1(1.), fDx2(1.), fDy1(1.), fDy2(1.), fDz(1.)
90 :
G4CSGSolid(rhs), halfCarTolerance(rhs.halfCarTolerance),
91 fDx1(rhs.fDx1), fDx2(rhs.fDx2),
92 fDy1(rhs.fDy1), fDy2(rhs.fDy2), fDz(rhs.fDz)
105 if (
this == &rhs) {
return *
this; }
155 message <<
"Invalid (too small or negative) dimensions for Solid: "
157 <<
"\n X - " <<
fDx1 <<
", " <<
fDx2
158 <<
"\n Y - " <<
fDy1 <<
", " <<
fDy2
160 G4Exception(
"G4Trd::CheckParameters()",
"GeomSolids0002",
174 G4double magx = std::sqrt(dx*dx + dz*dz);
175 G4double magy = std::sqrt(dy*dy + dz*dz);
258 pMin.
set(-xmax,-ymax,-dz);
259 pMax.
set( xmax, ymax, dz);
263 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
266 message <<
"Bad bounding box (min >= max) for solid: "
268 <<
"\npMin = " << pMin
269 <<
"\npMax = " <<
pMax;
296 return exist = (pMin <
pMax) ?
true :
false;
308 baseA[0].set(-dx1,-dy1,-dz);
309 baseA[1].set( dx1,-dy1,-dz);
310 baseA[2].set( dx1, dy1,-dz);
311 baseA[3].set(-dx1, dy1,-dz);
312 baseB[0].set(-dx2,-dy2, dz);
313 baseB[1].set( dx2,-dy2, dz);
314 baseB[2].set( dx2, dy2, dz);
315 baseB[3].set(-dx2, dy2, dz);
317 std::vector<const G4ThreeVectorList *> polygons(2);
318 polygons[0] = &baseA;
319 polygons[1] = &baseB;
357 nz = (p.
z() < 0) ? -1 : 1;
407 G4int oldprc = message.precision(16);
408 message <<
"Point p is not on surface (!?) of solid: "
410 message <<
"Position:\n";
411 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
412 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
413 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
414 G4cout.precision(oldprc) ;
415 G4Exception(
"G4Trd::SurfaceNormal(p)",
"GeomSolids1002",
432 for (
G4int i=0; i<4; ++i)
437 if (d > dist) { dist =
d; iside = i; }
466 G4double tmin0 = tzmin, tmax0 = tzmax;
475 if (tmin0 < tmp) tmin0 =
tmp;
480 if (tmax0 > tmp) tmax0 =
tmp;
483 G4double tmin1 = tmin0, tmax1 = tmax0;
490 if (tmin1 < tmp) tmin1 =
tmp;
495 if (tmax1 > tmp) tmax1 =
tmp;
500 G4double tmin2 = tmin1, tmax2 = tmax1;
509 if (tmin2 < tmp) tmin2 =
tmp;
514 if (tmax2 > tmp) tmax2 =
tmp;
517 G4double tmin3 = tmin2, tmax3 = tmax2;
524 if (tmin3 < tmp) tmin3 =
tmp;
529 if (tmax3 > tmp) tmax3 =
tmp;
534 G4double tmin = tmin3, tmax = tmax3;
554 return (dist > 0) ? dist : 0.;
574 n->
set(0, 0, (p.
z() < 0) ? -1 : 1);
580 G4int iside = (vz < 0) ? -4 : -2;
601 if (tmax > tmp) { tmax =
tmp; iside = i; }
623 if (tmax > tmp) { tmax =
tmp; iside = i; }
633 n->
set(0, 0, iside + 3);
651 G4int oldprc = message.precision(16);
652 message <<
"Point p is outside (!?) of solid: " <<
GetName() <<
G4endl;
653 message <<
"Position:\n";
654 message <<
" p.x() = " << p.
x()/
mm <<
" mm\n";
655 message <<
" p.y() = " << p.
y()/
mm <<
" mm\n";
656 message <<
" p.z() = " << p.
z()/
mm <<
" mm";
657 G4cout.precision(oldprc) ;
658 G4Exception(
"G4Trd::DistanceToOut(p)",
"GeomSolids1002",
670 return (dist < 0) ? -dist : 0.;
688 return new G4Trd(*
this);
697 G4int oldprc = os.precision(16);
698 os <<
"-----------------------------------------------------------\n"
699 <<
" *** Dump for solid - " <<
GetName() <<
" ***\n"
700 <<
" ===================================================\n"
701 <<
" Solid type: G4Trd\n"
703 <<
" half length X, surface -dZ: " <<
fDx1/
mm <<
" mm \n"
704 <<
" half length X, surface +dZ: " <<
fDx2/
mm <<
" mm \n"
705 <<
" half length Y, surface -dZ: " <<
fDy1/
mm <<
" mm \n"
706 <<
" half length Y, surface +dZ: " <<
fDy2/
mm <<
" mm \n"
707 <<
" half length Z : " <<
fDz/
mm <<
" mm \n"
708 <<
"-----------------------------------------------------------\n";
709 os.precision(oldprc);
735 { {0,1,3,2}, {0,4,5,1}, {2,3,7,6}, {0,2,6,4}, {1,5,7,3}, {4,6,7,5} };
742 for (
G4int i=1; i<6; ++i) { sface[i] += sface[i-1]; }
748 if (select <= sface[4]) k = 4;
749 if (select <= sface[3]) k = 3;
750 if (select <= sface[2]) k = 2;
751 if (select <= sface[1]) k = 1;
752 if (select <= sface[0]) k = 0;
768 if (u + v > 1.) { u = 1. -
u; v = 1. -
v; }
769 return (1.-u-v)*pt[i0] + u*pt[i1] + v*pt[i3];