34#if ( defined(G4GEOM_USE_USOLIDS) || defined(G4GEOM_USE_PARTIAL_USOLIDS) )
47G4UEllipticalCone::G4UEllipticalCone(
const G4String& pName,
52 : Base_t(pName, a, b, h, cut)
60G4UEllipticalCone::G4UEllipticalCone( __void__& a )
68G4UEllipticalCone::~G4UEllipticalCone() =
default;
74G4UEllipticalCone::G4UEllipticalCone(
const G4UEllipticalCone& rhs)
82G4UEllipticalCone& G4UEllipticalCone::operator = (
const G4UEllipticalCone& rhs)
86 if (
this == &rhs) {
return *
this; }
90 Base_t::operator=(rhs);
99G4double G4UEllipticalCone::GetSemiAxisX()
const
101 return Base_t::GetSemiAxisX();
104G4double G4UEllipticalCone::GetSemiAxisY()
const
106 return Base_t::GetSemiAxisY();
109G4double G4UEllipticalCone::GetZMax()
const
111 return Base_t::GetZMax();
114G4double G4UEllipticalCone::GetZTopCut()
const
116 return Base_t::GetZTopCut();
119G4double G4UEllipticalCone::GetSemiAxisMax ()
const
121 return std::max(GetSemiAxisX(),GetSemiAxisY());
124G4double G4UEllipticalCone::GetSemiAxisMin ()
const
126 return std::min(GetSemiAxisX(),GetSemiAxisY());
135 Base_t::SetParameters(x, y, z, GetZTopCut());
138void G4UEllipticalCone::SetZCut(
G4double newzTopCut)
140 Base_t::SetParameters(GetSemiAxisX(), GetSemiAxisY(), GetZMax(), newzTopCut);
147G4VSolid* G4UEllipticalCone::Clone()
const
149 return new G4UEllipticalCone(*
this);
161 G4double xmax = GetSemiAxisX()*(height+zcut);
162 G4double ymax = GetSemiAxisY()*(height+zcut);
163 pMin.
set(-xmax,-ymax,-zcut);
164 pMax.
set( xmax, ymax, zcut);
168 if (pMin.
x() >= pMax.
x() || pMin.
y() >= pMax.
y() || pMin.
z() >= pMax.
z())
170 std::ostringstream message;
171 message <<
"Bad bounding box (min >= max) for solid: "
173 <<
"\npMin = " << pMin
174 <<
"\npMax = " << pMax;
175 G4Exception(
"G4UEllipticalCone::BoundingLimits()",
"GeomMgt0001",
186G4UEllipticalCone::CalculateExtent(
const EAxis pAxis,
196 BoundingLimits(bmin,bmax);
199 return bbox.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
201 if (bbox.BoundingBoxVsVoxelLimits(pAxis,pVoxelLimit,pTransform,pMin,pMax))
203 return exist = pMin < pMax;
208 static const G4int NSTEPS = 48;
209 static const G4double ang = twopi/NSTEPS;
210 static const G4double sinHalf = std::sin(0.5*ang);
211 static const G4double cosHalf = std::cos(0.5*ang);
212 static const G4double sinStep = 2.*sinHalf*cosHalf;
213 static const G4double cosStep = 1. - 2.*sinHalf*sinHalf;
216 G4double sxmin = GetSemiAxisX()*(height-zcut)/cosHalf;
217 G4double symin = GetSemiAxisY()*(height-zcut)/cosHalf;
224 for (
G4int k=0; k<NSTEPS; ++k)
226 baseA[k].set(sxmax*cosCur,symax*sinCur,-zcut);
227 baseB[k].set(sxmin*cosCur,symin*sinCur, zcut);
230 sinCur = sinCur*cosStep + cosCur*sinStep;
231 cosCur = cosCur*cosStep - sinTmp*sinStep;
234 std::vector<const G4ThreeVectorList *> polygons(2);
235 polygons[0] = &baseA;
236 polygons[1] = &baseB;
238 exist = benv.CalculateExtent(pAxis,pVoxelLimit,pTransform,pMin,pMax);
246G4Polyhedron* G4UEllipticalCone::CreatePolyhedron()
const
249 GetZMax(), GetZTopCut());
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)