Change geom::length behavior: always (max-min), even if empty

This commit is contained in:
Nikita Lisitsa 2020-10-21 22:23:57 +03:00
parent 10213bb3d9
commit c1d9095327
2 changed files with 3 additions and 3 deletions

View file

@ -91,7 +91,7 @@ namespace psemek::geom
T length() const
{
return empty() ? T{} : max - min;
return max - min;
}
T center() const

View file

@ -79,10 +79,10 @@ namespace psemek::geom
auto m = matrix<T, D + 1, D + 1>::zero();
for (std::size_t d = 0; d < D; ++d)
m[d][d] = T(2) / (r_[d].max - r_[d].min);
m[d][d] = T(2) / r_[d].length();
for (std::size_t d = 0; d < D; ++d)
m[d][D] = - (r_[d].max + r_[d].min) / (r_[d].max - r_[d].min);
m[d][D] = - (r_[d].max + r_[d].min) / r_[d].length();
m[D][D] = T(1);