34#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
48G4UCons::G4UCons(
const G4String& pName,
53 : Base_t(pName, pRmin1, pRmax1, pRmin2, pRmax2, pDz, pSPhi, pDPhi)
62G4UCons::G4UCons( __void__& a )
79G4UCons::G4UCons(
const G4UCons& rhs)
88G4UCons& G4UCons::operator = (
const G4UCons& rhs)
92 if (
this == &rhs) {
return *
this; }
96 Base_t::operator=(rhs);
105G4double G4UCons::GetInnerRadiusMinusZ()
const
109G4double G4UCons::GetOuterRadiusMinusZ()
const
113G4double G4UCons::GetInnerRadiusPlusZ()
const
117G4double G4UCons::GetOuterRadiusPlusZ()
const
121G4double G4UCons::GetZHalfLength()
const
125G4double G4UCons::GetStartPhiAngle()
const
129G4double G4UCons::GetDeltaPhiAngle()
const
133G4double G4UCons::GetSinStartPhi()
const
136 return std::sin(phi);
138G4double G4UCons::GetCosStartPhi()
const
141 return std::cos(phi);
143G4double G4UCons::GetSinEndPhi()
const
145 G4double phi = GetStartPhiAngle() + GetDeltaPhiAngle();
146 return std::sin(phi);
148G4double G4UCons::GetCosEndPhi()
const
150 G4double phi = GetStartPhiAngle() + GetDeltaPhiAngle();
151 return std::cos(phi);
154void G4UCons::SetInnerRadiusMinusZ(
G4double Rmin1)
157 fRebuildPolyhedron =
true;
159void G4UCons::SetOuterRadiusMinusZ(
G4double Rmax1)
162 fRebuildPolyhedron =
true;
164void G4UCons::SetInnerRadiusPlusZ(
G4double Rmin2)
167 fRebuildPolyhedron =
true;
169void G4UCons::SetOuterRadiusPlusZ(
G4double Rmax2)
172 fRebuildPolyhedron =
true;
174void G4UCons::SetZHalfLength(
G4double newDz)
177 fRebuildPolyhedron =
true;
182 fRebuildPolyhedron =
true;
184void G4UCons::SetDeltaPhiAngle(
G4double newDPhi)
187 fRebuildPolyhedron =
true;
208 return new G4UCons(*
this);
217 static G4bool checkBBox =
true;
219 G4double rmin = std::min(GetInnerRadiusMinusZ(),GetInnerRadiusPlusZ());
220 G4double rmax = std::max(GetOuterRadiusMinusZ(),GetOuterRadiusPlusZ());
225 if (GetDeltaPhiAngle() < twopi)
229 GetSinStartPhi(),GetCosStartPhi(),
230 GetSinEndPhi(),GetCosEndPhi(),
232 pMin.
set(vmin.
x(),vmin.
y(),-dz);
233 pMax.
set(vmax.
x(),vmax.
y(), dz);
237 pMin.
set(-rmax,-rmax,-dz);
238 pMax.
set( rmax, rmax, dz);
243 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
245 std::ostringstream message;
246 message <<
"Bad bounding box (min >= max) for solid: "
248 <<
"\npMin = " << pMin
249 <<
"\npMax = " << pMax;
250 G4Exception(
"G4UCons::BoundingLimits()",
"GeomMgt0001",
268 std::ostringstream message;
269 message <<
"Inconsistency in bounding boxes for solid: "
271 <<
"\nBBox min: wrapper = " << pMin <<
" solid = " << vmin
272 <<
"\nBBox max: wrapper = " << pMax <<
" solid = " << vmax;
273 G4Exception(
"G4UCons::BoundingLimits()",
"GeomMgt0001",
285G4UCons::CalculateExtent(
const EAxis pAxis,
294 BoundingLimits(bmin,bmax);
299 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
301 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
303 return exist = (pMin < pMax) ?
true :
false;
307 G4double rmin1 = GetInnerRadiusMinusZ();
308 G4double rmax1 = GetOuterRadiusMinusZ();
309 G4double rmin2 = GetInnerRadiusPlusZ();
310 G4double rmax2 = GetOuterRadiusPlusZ();
316 const G4int NSTEPS = 24;
318 G4int ksteps = (dphi <= astep) ? 1 : (
G4int)((dphi-deg)/astep) + 1;
321 G4double sinHalf = std::sin(0.5*ang);
322 G4double cosHalf = std::cos(0.5*ang);
323 G4double sinStep = 2.*sinHalf*cosHalf;
324 G4double cosStep = 1. - 2.*sinHalf*sinHalf;
330 if (rmin1 == 0 && rmin2 == 0 && dphi == twopi)
336 for (
G4int k=0; k<NSTEPS; ++k)
338 baseA[k].set(rext1*cosCur,rext1*sinCur,-dz);
339 baseB[k].set(rext2*cosCur,rext2*sinCur, dz);
342 sinCur = sinCur*cosStep + cosCur*sinStep;
343 cosCur = cosCur*cosStep - sinTmp*sinStep;
345 std::vector<const G4ThreeVectorList *> polygons(2);
346 polygons[0] = &baseA;
347 polygons[1] = &baseB;
349 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
353 G4double sinStart = GetSinStartPhi();
354 G4double cosStart = GetCosStartPhi();
357 G4double sinCur = sinStart*cosHalf + cosStart*sinHalf;
358 G4double cosCur = cosStart*cosHalf - sinStart*sinHalf;
362 for (
G4int k=0; k<ksteps+2; ++k) pols[k].resize(4);
363 pols[0][0].set(rmin2*cosStart,rmin2*sinStart, dz);
364 pols[0][1].set(rmin1*cosStart,rmin1*sinStart,-dz);
365 pols[0][2].set(rmax1*cosStart,rmax1*sinStart,-dz);
366 pols[0][3].set(rmax2*cosStart,rmax2*sinStart, dz);
367 for (
G4int k=1; k<ksteps+1; ++k)
369 pols[k][0].set(rmin2*cosCur,rmin2*sinCur, dz);
370 pols[k][1].set(rmin1*cosCur,rmin1*sinCur,-dz);
371 pols[k][2].set(rext1*cosCur,rext1*sinCur,-dz);
372 pols[k][3].set(rext2*cosCur,rext2*sinCur, dz);
375 sinCur = sinCur*cosStep + cosCur*sinStep;
376 cosCur = cosCur*cosStep - sinTmp*sinStep;
378 pols[ksteps+1][0].set(rmin2*cosEnd,rmin2*sinEnd, dz);
379 pols[ksteps+1][1].set(rmin1*cosEnd,rmin1*sinEnd,-dz);
380 pols[ksteps+1][2].set(rmax1*cosEnd,rmax1*sinEnd,-dz);
381 pols[ksteps+1][3].set(rmax2*cosEnd,rmax2*sinEnd, dz);
384 std::vector<const G4ThreeVectorList *> polygons;
385 polygons.resize(ksteps+2);
386 for (
G4int k=0; k<ksteps+2; ++k) polygons[k] = &pols[k];
388 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
400 GetOuterRadiusMinusZ(),
401 GetInnerRadiusPlusZ(),
402 GetOuterRadiusPlusZ(),
const G4double kCarTolerance
std::vector< G4ThreeVector > G4ThreeVectorList
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