Commit 95740035 authored by Kersten Schuster's avatar Kersten Schuster
Browse files

Fixed contains(sphere, pos) test.

parent a3b7af6d
......@@ -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
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment