Skip to content

Commit

Permalink
Revert "Avoid some extra calculations in intersects(sphere, point)"
Browse files Browse the repository at this point in the history
  • Loading branch information
aprokop committed Dec 21, 2023
1 parent a522958 commit 86adf2c
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions src/geometry/ArborX_DetailsAlgorithms.hpp
Expand Up @@ -410,20 +410,7 @@ struct intersects<SphereTag, PointTag, Sphere, Point>
KOKKOS_FUNCTION static constexpr bool apply(Sphere const &sphere,
Point const &point)
{
constexpr int DIM = GeometryTraits::dimension_v<Point>;
auto c = sphere.centroid();
// Points may have different coordinate types. Try using implicit
// conversion to get the best one.
using Coordinate = decltype(c[0] - point[0]);
Coordinate distance_squared = 0;
for (int d = 0; d < DIM; ++d)
{
auto tmp = c[d] - point[d];
distance_squared += tmp * tmp;
}

auto r = sphere.radius();
return distance_squared <= r * r;
return Details::distance(sphere.centroid(), point) <= sphere.radius();
}
};

Expand Down

0 comments on commit 86adf2c

Please sign in to comment.