diff --git a/libs/geom/include/psemek/geom/contains.hpp b/libs/geom/include/psemek/geom/contains.hpp index 3fb65f00..579e1fe1 100644 --- a/libs/geom/include/psemek/geom/contains.hpp +++ b/libs/geom/include/psemek/geom/contains.hpp @@ -24,6 +24,21 @@ namespace psemek::geom return true; } + template + bool half_open_contains(interval const & i, T const & x) + { + return (i.min <= x) && (x < i.max); + } + + template + bool half_open_contains(box const & b, point const & p) + { + for (std::size_t i = 0; i < N; ++i) + if (!half_open_contains(b[i], p[i])) + return false; + return true; + } + template bool contains(simplex, 2> const & t, point const & p) {