12 if (!solid || !medium) {
13 std::cerr <<
m_className <<
"::AddSolid: Null pointer.\n";
18 double xmin, ymin, zmin;
19 double xmax, ymax, zmax;
21 std::cerr <<
m_className <<
"::AddSolid: Solid has no bounding box.\n";
43 m_solids.emplace_back(std::make_pair(solid, medium));
47 const double z,
const bool tesselated)
const {
49 if (solid.first->IsInside(x, y, z, tesselated))
return solid.first;
55 const double x,
const double y,
const double z,
56 const bool tesselated)
const {
58 if (solid.first->IsInside(x, y, z, tesselated)) {
67 std::cerr <<
m_className <<
"::GetSolid: Index out of range.\n";
75 std::cerr <<
m_className <<
"::GetSolid: Index out of range.\n";
89 const auto nSolids =
m_solids.size();
91 std::cout <<
" 1 solid\n";
93 std::cout <<
" " << nSolids <<
" solids\n";
96 std::cout <<
" Index Type Medium\n";
97 for (
size_t i = 0; i < nSolids; ++i) {
98 std::cout <<
" " << i <<
" ";
101 }
else if (
m_solids[i].first->IsTube()) {
102 std::cout <<
"tube ";
103 }
else if (
m_solids[i].first->IsSphere()) {
104 std::cout <<
"sphere ";
105 }
else if (
m_solids[i].first->IsHole()) {
106 std::cout <<
"hole ";
107 }
else if (
m_solids[i].first->IsRidge()) {
108 std::cout <<
"ridge ";
109 }
else if (
m_solids[i].first->IsExtrusion()) {
110 std::cout <<
"extrusion ";
111 }
else if (
m_solids[i].first->IsWire()) {
112 std::cout <<
"wire ";
114 std::cout <<
"unknown ";
117 std::cout <<
m_solids[i].second->GetName() <<
"\n";
119 std::cout <<
" ---\n";
125 const double z,
const bool tesselated)
const {
128 for (
const auto& solid :
m_solids) {
129 if (solid.first->IsInside(x, y, z, tesselated))
return true;
135 const double z)
const {
139 <<
" Bounding box is not defined.\n";
bool IsInside(const double x, const double y, const double z, const bool tesselated=false) const override
Check if a point is inside the geometry.
Medium * m_medium
Background medium.
std::array< double, 3 > m_bbMin
Medium * GetMedium(const double x, const double y, const double z, const bool tesselated=false) const override
Retrieve the medium at a given point.
std::array< double, 3 > m_bbMax
std::vector< std::pair< Solid *, Medium * > > m_solids
List of solids and associated media.
bool IsInBoundingBox(const double x, const double y, const double z) const
Determine whether a point is inside the envelope of the geometry.
Solid * GetSolid(const size_t i) const override
Get a solid from the list.
void Clear()
Reset the geometry.
void PrintSolids()
Print a summary of the solids present in the geometry.
bool m_debug
Switch on/off debugging messages.
void AddSolid(Solid *s, Medium *m)
Add a solid to the geometry, together with the medium inside.
GeometrySimple()
Constructor.
Abstract base class for geometry classes.
Abstract base class for media.
Abstract base class for solids.
virtual bool GetBoundingBox(double &xmin, double &ymin, double &zmin, double &xmax, double &ymax, double &zmax) const =0
Return the bounding box of the solid.