Add geom::clamp(point, box)
This commit is contained in:
parent
e266bb476e
commit
32461e205e
1 changed files with 8 additions and 0 deletions
|
|
@ -252,6 +252,14 @@ namespace psemek::geom
|
||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T, std::size_t N>
|
||||||
|
point<T, N> clamp(point<T, N> p, box<T, N> const & b)
|
||||||
|
{
|
||||||
|
for (std::size_t i = 0; i < N; ++i)
|
||||||
|
p[i] = clamp(p[i], b[i]);
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T, std::size_t N>
|
template <typename T, std::size_t N>
|
||||||
box<T, N> expand(box<T, N> b, T const & d)
|
box<T, N> expand(box<T, N> b, T const & d)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue