Skip to content
Snippets Groups Projects

Fixed contains(sphere, pos) test.

Merged Kersten Schuster requested to merge kschuster into develop
1 file
+ 2
1
Compare changes
  • Side-by-side
  • Inline
@@ -102,7 +102,8 @@ TG_NODISCARD constexpr bool contains(ball<D, ScalarT> const& s, pos<D, ScalarT>
template <int D, class ScalarT>
TG_NODISCARD constexpr bool contains(sphere<D, ScalarT> const& s, pos<D, ScalarT> const& p, ScalarT eps = ScalarT(0))
{
return tg::abs(distance_sqr(s.center, p) - s.radius * s.radius) <= eps;
auto r = s.radius + eps;
return distance_sqr(s.center, p) <= r * r;
}
// Note that eps is used to compare 2D areas, not 1D lengths
Loading