From 9d3f13a40faaab8f585fc149d86c4856daa4c627 Mon Sep 17 00:00:00 2001 From: Kai Szuttor Date: Mon, 24 Feb 2020 10:59:05 +0100 Subject: [PATCH] core: shapes: Union: provide override for is_inside. --- src/core/shapes/Union.hpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/core/shapes/Union.hpp b/src/core/shapes/Union.hpp index 92771d2a309..48fac68f31c 100644 --- a/src/core/shapes/Union.hpp +++ b/src/core/shapes/Union.hpp @@ -20,6 +20,7 @@ #ifndef SHAPES_UNION #define SHAPES_UNION +#include #include #include "Shape.hpp" @@ -66,6 +67,14 @@ class Union : public Shape { dist_compare); } + bool is_inside(Utils::Vector3d const &pos) const override { + return boost::accumulate( + m_shapes, false, + [&pos](bool inside, std::shared_ptr const &s) { + return inside && s->is_inside(pos); + }); + } + private: std::vector> m_shapes; };