Skip to content
Snippets Groups Projects
Commit b85f78be authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ZLimits preferred API: zBottom, zTop

parent 73c218b4
No related branches found
No related tags found
1 merge request!134simplify ZLimits
......@@ -24,34 +24,28 @@
#include <utility>
namespace {
bool shapeIsContainedInLimits(const IFormFactor& formfactor, ZLimits limits, const IRotation& rot,
kvector_t translation)
{
double zbottom = formfactor.bottomZ(rot) + translation.z();
double ztop = formfactor.topZ(rot) + translation.z();
OneSidedLimit lower_limit = limits.lowerZLimit();
OneSidedLimit upper_limit = limits.upperZLimit();
if (!upper_limit.m_limitless && ztop > upper_limit.m_limit_z)
return false;
if (!lower_limit.m_limitless && zbottom < lower_limit.m_limit_z)
return false;
return true;
return limits.zBottom() <= zbottom && ztop <= limits.zTop();
}
bool shapeOutsideLimits(const IFormFactor& formfactor, ZLimits limits, const IRotation& rot,
kvector_t translation)
{
double zbottom = formfactor.bottomZ(rot) + translation.z();
double ztop = formfactor.topZ(rot) + translation.z();
OneSidedLimit lower_limit = limits.lowerZLimit();
OneSidedLimit upper_limit = limits.upperZLimit();
if (!upper_limit.m_limitless && zbottom >= upper_limit.m_limit_z)
return true;
if (!lower_limit.m_limitless && ztop <= lower_limit.m_limit_z)
return true;
return false;
return ztop <= limits.zBottom() || zbottom >= limits.zTop();
}
} // namespace
IFormFactor::IFormFactor(const NodeMeta& meta, const std::vector<double>& PValues)
: ISampleNode(meta, PValues), m_nodeMeta(meta)
{
......
......@@ -51,6 +51,9 @@ public:
bool isFinite() const;
double zBottom() const { return m_zmin; }
double zTop() const { return m_zmax; }
OneSidedLimit lowerZLimit() const;
OneSidedLimit upperZLimit() const;
......
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