From 27dbe08891d46b70a2327cd1f8cc864d6f0960f2 Mon Sep 17 00:00:00 2001 From: "Joachim Wuttke (o)" <j.wuttke@fz-juelich.de> Date: Mon, 28 Nov 2022 16:47:27 +0100 Subject: [PATCH] simplify alpha test in Pyramid2 --- Sample/HardParticle/Pyramid2.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Sample/HardParticle/Pyramid2.cpp b/Sample/HardParticle/Pyramid2.cpp index e5cff650504..83718a588d8 100644 --- a/Sample/HardParticle/Pyramid2.cpp +++ b/Sample/HardParticle/Pyramid2.cpp @@ -45,12 +45,11 @@ std::string Pyramid2::validate() const requestGt0(errs, m_length, "length"); requestGt0(errs, m_width, "width"); requestGt0(errs, m_height, "height"); - const double cot_alpha = Math::cot(m_alpha); - if (m_alpha <= 0 || !std::isfinite(cot_alpha) || cot_alpha < 0) - errs.push_back("pyramid angle alpha " + std::to_string(m_alpha) + " out of bounds"); + requestIn(errs, m_alpha, "alpha", 0, M_PI_2); if (!errs.empty()) return jointError(errs); + const double cot_alpha = Math::cot(m_alpha); double r = cot_alpha * 2 * m_height / m_length; double s = cot_alpha * 2 * m_height / m_width; if (r > 1) -- GitLab