mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 05:24:02 +00:00
[strategies] Add less-comparator for projected_point_ax result in detail::douglas_peucker
This commit is contained in:
parent
282a2536a3
commit
e49434ec6c
@ -67,12 +67,27 @@ struct projected_point_ax_result
|
||||
{}
|
||||
|
||||
T atd, xtd;
|
||||
};
|
||||
|
||||
friend bool operator>(projected_point_ax_result const& left,
|
||||
projected_point_ax_result const& right)
|
||||
// This less-comparator may be used as a parameter of detail::douglas_peucker.
|
||||
// In this simplify strategy distances are compared in 2 places
|
||||
// 1. to choose the furthest candidate (md < dist)
|
||||
// 2. to check if the candidate is further than max_distance (max_distance < md)
|
||||
template <typename Distance>
|
||||
class projected_point_ax_less
|
||||
{
|
||||
public:
|
||||
projected_point_ax_less(Distance const& max_distance)
|
||||
: m_max_distance(max_distance)
|
||||
{}
|
||||
|
||||
template <typename T>
|
||||
inline bool operator()(Distance const& left, Distance const& right) const
|
||||
{
|
||||
return left.atd > right.atd || left.xtd > right.xtd;
|
||||
return left.xtd < right.xtd && right.atd < m_max_distance.atd;
|
||||
}
|
||||
private:
|
||||
Distance const& m_max_distance;
|
||||
};
|
||||
|
||||
// This strategy returns 2-component Point/Segment distance.
|
||||
|
Loading…
x
Reference in New Issue
Block a user