From c3666aeaf5aa800070b495ca26979820c611385f Mon Sep 17 00:00:00 2001 From: Mikhail Svechnikov <m.svechnikov@fz-juelich.de> Date: Mon, 12 Aug 2024 17:17:02 +0200 Subject: [PATCH] fix bottom of rough box --- Img3D/Mesh/Box.cpp | 10 ++++++---- Img3D/Model/PlottableBody.cpp | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Img3D/Mesh/Box.cpp b/Img3D/Mesh/Box.cpp index c052f5ef561..357d3e9aa30 100644 --- a/Img3D/Mesh/Box.cpp +++ b/Img3D/Mesh/Box.cpp @@ -47,11 +47,13 @@ Geometry::Mesh Geometry::meshBox() Geometry::Mesh Geometry::meshRoughBox(const double2d_t* topR, const double2d_t* bottomR) { - ASSERT(topR); - ASSERT(topR->size()); + ASSERT(topR || bottomR); + const double2d_t* base = topR ? topR : bottomR; + ASSERT(base->size()); - const auto& t = *topR; - const auto& b = bottomR ? *bottomR : double2d_t(t.size(), std::vector<double>(t[0].size())); + const auto& t = topR ? *topR : double2d_t(base->size(), std::vector<double>(base[0].size())); + const auto& b = + bottomR ? *bottomR : double2d_t(base->size(), std::vector<double>(base[0].size())); float const D = 0.5f; diff --git a/Img3D/Model/PlottableBody.cpp b/Img3D/Model/PlottableBody.cpp index 5ebdd5e8f6e..74354ec61c3 100644 --- a/Img3D/Model/PlottableBody.cpp +++ b/Img3D/Model/PlottableBody.cpp @@ -71,7 +71,7 @@ PlottableBody::PlottableBody(GeometricID::Key gky_, const double2d_t* top, const , m_color(clrObject) , gky(gky_) { - if (top) + if (top || bottom) m_geo = std::shared_ptr<Geometry>(new Geometry(gky, top, bottom)); } -- GitLab