Add geom::contains(box, box)
This commit is contained in:
parent
ee9847a904
commit
5a0469364f
1 changed files with 15 additions and 0 deletions
|
|
@ -25,6 +25,21 @@ namespace psemek::geom
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
bool contains(interval<T> const & i1, interval<T> const i2)
|
||||||
|
{
|
||||||
|
return (i1.min <= i2.min) && (i2.max <= i1.max);
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
bool contains(box<T, N> const & b1, box<T, N> const & b2)
|
||||||
|
{
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
if (!contains(b1[i], b2[i]))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
bool half_open_contains(interval<T> const & i, T const & x)
|
bool half_open_contains(interval<T> const & i, T const & x)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue