Add box::corner - N-d lerp inside a box

This commit is contained in:
Nikita Lisitsa 2020-11-29 12:25:46 +03:00
parent a7f067bedb
commit c7b44a6925

View file

@ -65,6 +65,18 @@ namespace psemek::geom
return p;
}
template <typename ... Ts>
point_type corner(Ts const & ... ts) const
{
static_assert(sizeof...(Ts) == N);
T w[N] = {ts...};
point_type res;
for (std::size_t i = 0; i < N; ++i)
res[i] = lerp(axes[i], w[i]);
return res;
}
box & operator += (vector_type const & delta);
box & operator -= (vector_type const & delta);