Skip to content
Snippets Groups Projects
Commit 75034a8a authored by Vakho Tsulaia's avatar Vakho Tsulaia
Browse files

GeoPcon+GeoPgon: added some basic sanity checks

parent 93320e71
No related branches found
Tags 6.7.0
1 merge request!405GeoPcon+GeoPgon: added some basic sanity checks
Pipeline #9970070 passed
...@@ -93,6 +93,16 @@ bool GeoPcon::contains (double x, double y, double z) const ...@@ -93,6 +93,16 @@ bool GeoPcon::contains (double x, double y, double z) const
void GeoPcon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane) void GeoPcon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane)
{ {
// Basic sanity checks
if(RMinPlane < 0.
|| RMaxPlane <= 0.
|| RMaxPlane < RMinPlane) {
THROW_EXCEPTION("GeoPcon::addPlane() wrong arguments! ("
<< ZPlane << ","
<< RMinPlane << ","
<< RMaxPlane << ")");
}
m_zPlane.push_back (ZPlane); m_zPlane.push_back (ZPlane);
m_rMinPlane.push_back (RMinPlane); m_rMinPlane.push_back (RMinPlane);
m_rMaxPlane.push_back (RMaxPlane); m_rMaxPlane.push_back (RMaxPlane);
...@@ -100,5 +110,8 @@ void GeoPcon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane) ...@@ -100,5 +110,8 @@ void GeoPcon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane)
void GeoPcon::exec (GeoShapeAction *action) const void GeoPcon::exec (GeoShapeAction *action) const
{ {
if (!isValid ())
THROW_EXCEPTION("Requested to execute action for incomplete polycone");
action->handlePcon(this); action->handlePcon(this);
} }
...@@ -148,6 +148,16 @@ bool GeoPgon::contains (double x, double y, double z) const ...@@ -148,6 +148,16 @@ bool GeoPgon::contains (double x, double y, double z) const
void GeoPgon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane) void GeoPgon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane)
{ {
// Basic sanity checks
if(RMinPlane < 0.
|| RMaxPlane <= 0.
|| RMaxPlane < RMinPlane) {
THROW_EXCEPTION("GeoPcon::addPlane() wrong arguments! ("
<< ZPlane << ","
<< RMinPlane << ","
<< RMaxPlane << ")");
}
m_zPlane.push_back (ZPlane); m_zPlane.push_back (ZPlane);
m_rMinPlane.push_back (RMinPlane); m_rMinPlane.push_back (RMinPlane);
m_rMaxPlane.push_back (RMaxPlane); m_rMaxPlane.push_back (RMaxPlane);
...@@ -155,5 +165,8 @@ void GeoPgon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane) ...@@ -155,5 +165,8 @@ void GeoPgon::addPlane (double ZPlane, double RMinPlane, double RMaxPlane)
void GeoPgon::exec (GeoShapeAction *action) const void GeoPgon::exec (GeoShapeAction *action) const
{ {
if (!isValid ())
THROW_EXCEPTION("Requested to execute action for incomplete polygon");
action->handlePgon(this); action->handlePgon(this);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment