34#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
48G4USphere::G4USphere(
const G4String& pName,
52 : Base_t(pName, pRmin, pRmax, pSPhi, pDPhi, pSTheta, pDTheta)
61G4USphere::G4USphere( __void__& a )
70G4USphere::~G4USphere()
78G4USphere::G4USphere(
const G4USphere& rhs)
87G4USphere& G4USphere::operator = (
const G4USphere& rhs)
91 if (
this == &rhs) {
return *
this; }
95 Base_t::operator=(rhs);
104G4double G4USphere::GetInnerRadius()
const
106 return Base_t::GetInnerRadius();
108G4double G4USphere::GetOuterRadius()
const
110 return Base_t::GetOuterRadius();
112G4double G4USphere::GetStartPhiAngle()
const
114 return Base_t::GetStartPhiAngle();
116G4double G4USphere::GetDeltaPhiAngle()
const
118 return Base_t::GetDeltaPhiAngle();
120G4double G4USphere::GetStartThetaAngle()
const
122 return Base_t::GetStartThetaAngle();
124G4double G4USphere::GetDeltaThetaAngle()
const
126 return Base_t::GetDeltaThetaAngle();
128G4double G4USphere::GetSinStartPhi()
const
130 return Base_t::GetSinSPhi();
132G4double G4USphere::GetCosStartPhi()
const
134 return Base_t::GetCosSPhi();
136G4double G4USphere::GetSinEndPhi()
const
138 return Base_t::GetSinEPhi();
140G4double G4USphere::GetCosEndPhi()
const
142 return Base_t::GetCosEPhi();
144G4double G4USphere::GetSinStartTheta()
const
146 return Base_t::GetSinSTheta();
148G4double G4USphere::GetCosStartTheta()
const
150 return Base_t::GetCosSTheta();
152G4double G4USphere::GetSinEndTheta()
const
154 return Base_t::GetSinETheta();
156G4double G4USphere::GetCosEndTheta()
const
158 return Base_t::GetCosETheta();
161void G4USphere::SetInnerRadius(
G4double newRMin)
163 Base_t::SetInnerRadius(newRMin);
164 fRebuildPolyhedron =
true;
166void G4USphere::SetOuterRadius(
G4double newRmax)
168 Base_t::SetOuterRadius(newRmax);
169 fRebuildPolyhedron =
true;
173 Base_t::SetStartPhiAngle(newSphi, trig);
174 fRebuildPolyhedron =
true;
176void G4USphere::SetDeltaPhiAngle(
G4double newDphi)
178 Base_t::SetDeltaPhiAngle(newDphi);
179 fRebuildPolyhedron =
true;
181void G4USphere::SetStartThetaAngle(
G4double newSTheta)
183 Base_t::SetStartThetaAngle(newSTheta);
184 fRebuildPolyhedron =
true;
186void G4USphere::SetDeltaThetaAngle(
G4double newDTheta)
188 Base_t::SetDeltaThetaAngle(newDTheta);
189 fRebuildPolyhedron =
true;
210 return new G4USphere(*
this);
219 static G4bool checkBBox =
true;
226 if (GetDeltaThetaAngle() >= pi && GetDeltaPhiAngle() >= twopi)
228 pMin.
set(-rmax,-rmax,-rmax);
229 pMax.
set( rmax, rmax, rmax);
233 G4double sinStart = GetSinStartTheta();
234 G4double cosStart = GetCosStartTheta();
238 G4double stheta = GetStartThetaAngle();
239 G4double etheta = stheta + GetDeltaThetaAngle();
240 G4double rhomin = rmin*std::min(sinStart,sinEnd);
242 if (stheta > halfpi) rhomax = rmax*sinStart;
243 if (etheta < halfpi) rhomax = rmax*sinEnd;
247 GetSinStartPhi(),GetCosStartPhi(),
248 GetSinEndPhi(),GetCosEndPhi(),
251 G4double zmin = std::min(rmin*cosEnd,rmax*cosEnd);
252 G4double zmax = std::max(rmin*cosStart,rmax*cosStart);
253 pMin.
set(xymin.
x(),xymin.
y(),zmin);
254 pMax.
set(xymax.
x(),xymax.
y(),zmax);
259 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
261 std::ostringstream message;
262 message <<
"Bad bounding box (min >= max) for solid: "
264 <<
"\npMin = " << pMin
265 <<
"\npMax = " << pMax;
266 G4Exception(
"G4USphere::BoundingLimits()",
"GeomMgt0001",
284 std::ostringstream message;
285 message <<
"Inconsistency in bounding boxes for solid: "
287 <<
"\nBBox min: wrapper = " << pMin <<
" solid = " << vmin
288 <<
"\nBBox max: wrapper = " << pMax <<
" solid = " << vmax;
289 G4Exception(
"G4USphere::BoundingLimits()",
"GeomMgt0001",
300G4bool G4USphere::CalculateExtent(
const EAxis pAxis,
308 BoundingLimits(bmin,bmax);
312 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
325 GetStartThetaAngle(),
326 GetDeltaThetaAngle());
const G4double kCarTolerance
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
G4GLOB_DLL std::ostream G4cout
void set(double x, double y, double z)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const