Add interval::center & box::center
This commit is contained in:
parent
b51e509562
commit
67ad584d48
2 changed files with 13 additions and 0 deletions
|
|
@ -49,6 +49,14 @@ namespace psemek::geom
|
|||
return result;
|
||||
}
|
||||
|
||||
point_type center() const
|
||||
{
|
||||
point_type p;
|
||||
for (std::size_t i = 0; i < N; ++i)
|
||||
p[i] = axes[i].center();
|
||||
return p;
|
||||
}
|
||||
|
||||
box & operator += (vector_type const & delta);
|
||||
box & operator -= (vector_type const & delta);
|
||||
|
||||
|
|
|
|||
|
|
@ -89,6 +89,11 @@ namespace psemek::geom
|
|||
return empty() ? T{} : max - min;
|
||||
}
|
||||
|
||||
T center() const
|
||||
{
|
||||
return min + (max - min) / 2;
|
||||
}
|
||||
|
||||
using iterator = interval_iterator<T>;
|
||||
using const_iterator = iterator;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue