mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-18 18:23:26 +00:00
added overload
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
#include <functional>
|
#include <functional>
|
||||||
#include <iterator>
|
#include <iterator>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <ranges>
|
||||||
|
|
||||||
namespace omath::algorithm
|
namespace omath::algorithm
|
||||||
{
|
{
|
||||||
@@ -47,4 +48,16 @@ namespace omath::algorithm
|
|||||||
return best_target;
|
return best_target;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<class CameraType, std::ranges::range RangeType, class FilterT>
|
||||||
|
requires std::is_invocable_r_v<bool, std::function<FilterT>,
|
||||||
|
std::ranges::range_reference_t<const RangeType>>
|
||||||
|
[[nodiscard]]
|
||||||
|
auto get_closest_target_by_fov(const RangeType& range, const CameraType& camera,
|
||||||
|
auto get_position,
|
||||||
|
const std::optional<std::function<FilterT>>& filter_func = std::nullopt)
|
||||||
|
{
|
||||||
|
return get_closest_target_by_fov<CameraType, decltype(std::ranges::begin(range)), FilterT>(
|
||||||
|
std::ranges::begin(range), std::ranges::end(range), camera, get_position, filter_func);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace omath::algorithm
|
} // namespace omath::algorithm
|
||||||
Reference in New Issue
Block a user