35 #if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
45 using namespace CLHEP;
53 : G4USolid(pName, new UOrb(pName, pRmax))
62 G4UOrb::G4UOrb( __void__&
a )
79 G4UOrb::G4UOrb(
const G4UOrb& rhs)
88 G4UOrb& G4UOrb::operator = (
const G4UOrb& rhs)
92 if (
this == &rhs) {
return *
this; }
96 G4USolid::operator=(rhs);
107 return GetShape()->GetRadius();
110 void G4UOrb::SetRadius(
G4double newRmax)
112 GetShape()->SetRadius(newRmax);
113 fRebuildPolyhedron =
true;
116 G4double G4UOrb::GetRadialTolerance()
const
118 return GetShape()->GetRadialTolerance();
139 return new G4UOrb(*
this);
149 pMin.
set(-radius,-radius,-radius);
150 pMax.
set( radius, radius, radius);
154 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
156 std::ostringstream message;
157 message <<
"Bad bounding box (min >= max) for solid: "
159 <<
"\npMin = " << pMin
160 <<
"\npMax = " << pMax;
171 G4UOrb::CalculateExtent(
const EAxis pAxis,
185 if (
true)
return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
187 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
189 return exist = (pMin < pMax) ?
true :
false;
194 static const G4int NTHETA = 8;
195 static const G4int NPHI = 16;
198 static const G4double sinHalfPhi = std::sin(
pi/NPHI);
199 static const G4double cosHalfPhi = std::cos(
pi/NPHI);
200 static const G4double sinStepTheta = 2.*sinHalfTheta*cosHalfTheta;
201 static const G4double cosStepTheta = 1. - 2.*sinHalfTheta*sinHalfTheta;
202 static const G4double sinStepPhi = 2.*sinHalfPhi*cosHalfPhi;
203 static const G4double cosStepPhi = 1. - 2.*sinHalfPhi*sinHalfPhi;
206 G4double rtheta = radius/cosHalfTheta;
213 for (
G4int k=0; k<NPHI; ++k)
215 xy[k].
set(cosCurPhi,sinCurPhi);
217 sinCurPhi = sinCurPhi*cosStepPhi + cosCurPhi*sinStepPhi;
218 cosCurPhi = cosCurPhi*cosStepPhi - sinTmpPhi*sinStepPhi;
223 for (
G4int i=0; i<NTHETA; ++i) circles[i].resize(NPHI);
225 G4double sinCurTheta = sinHalfTheta;
226 G4double cosCurTheta = cosHalfTheta;
227 for (
G4int i=0; i<NTHETA; ++i)
231 for (
G4int k=0; k<NPHI; ++k)
233 circles[i][k].set(rho*xy[k].
x(),rho*xy[k].y(),z);
236 sinCurTheta = sinCurTheta*cosStepTheta + cosCurTheta*sinStepTheta;
237 cosCurTheta = cosCurTheta*cosStepTheta - sinTmpTheta*sinStepTheta;
241 std::vector<const G4ThreeVectorList *> polygons;
242 polygons.resize(NTHETA);
243 for (
G4int i=0; i<NTHETA; ++i) polygons[i] = &circles[i];
246 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
259 #endif // G4GEOM_USE_USOLIDS
void set(double x, double y, double z)
std::vector< ExP01TrackerHit * > a
static constexpr double twopi
G4GLOB_DLL std::ostream G4cout
void set(double x, double y)
std::vector< G4ThreeVector > G4ThreeVectorList
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)
virtual void ComputeDimensions(G4Box &, const G4int, const G4VPhysicalVolume *) const
static constexpr double pi
static constexpr double halfpi