diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:45:20 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-03-21 15:46:37 +0900 |
commit | 733b5d5ae2c5d625211e2985ac25728ac3f54883 (patch) | |
tree | a5b214744b256f07e1dc2bd7273035a7808c659f /boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp | |
parent | 08c1e93fa36a49f49325a07fe91ff92c964c2b6c (diff) | |
download | boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.gz boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.tar.bz2 boost-733b5d5ae2c5d625211e2985ac25728ac3f54883.zip |
Imported Upstream version 1.58.0upstream/1.58.0
Change-Id: If0072143aa26874812e0db6872e1efb10a3e5e94
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp')
-rw-r--r-- | boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp | 59 |
1 files changed, 36 insertions, 23 deletions
diff --git a/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp b/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp index 9484479b45..7ed93f542a 100644 --- a/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp +++ b/boost/geometry/algorithms/detail/overlay/enrich_intersection_points.hpp @@ -56,13 +56,13 @@ struct indexed_turn_operation TurnOperation const* subject; inline indexed_turn_operation(std::size_t ti, std::size_t oi, - TurnOperation const& s, + TurnOperation const& sub, segment_identifier const& oid) : turn_index(ti) , operation_index(oi) , discarded(false) , other_seg_id(&oid) - , subject(&s) + , subject(boost::addressof(sub)) {} }; @@ -114,6 +114,12 @@ private : typedef typename geometry::point_type<Geometry1>::type point_type; + inline bool default_order(Indexed const& left, Indexed const& right) const + { + // We've nothing to sort on. Take the indexes + return left.turn_index < right.turn_index; + } + inline bool consider_relative_order(Indexed const& left, Indexed const& right) const { @@ -148,7 +154,12 @@ private : // If they both turn left: the most left as last // If they both turn right: this is not relevant, but take also here most left - return side_rj_s < side_sj_r; + if (side_rj_s != side_sj_r) + { + return side_rj_s < side_sj_r; + } + + return default_order(left, right); } public : @@ -157,30 +168,32 @@ public : // but to the "indexed_turn_operation" inline bool operator()(Indexed const& left, Indexed const& right) const { - segment_identifier const& sl = left.subject->seg_id; - segment_identifier const& sr = right.subject->seg_id; + if (! (left.subject->seg_id == right.subject->seg_id)) + { + return left.subject->seg_id < right.subject->seg_id; + } + + // Both left and right are located on the SAME segment. - if (sl == sr) + if (! (left.subject->fraction == right.subject->fraction)) { - // Both left and right are located on the SAME segment. - if (left.subject->fraction == right.subject->fraction) - { - // First check "real" intersection (crosses) - // -> distance zero due to precision, solve it by sorting - if (m_turn_points[left.turn_index].method == method_crosses - && m_turn_points[right.turn_index].method == method_crosses) - { - return consider_relative_order(left, right); - } + return left.subject->fraction < right.subject->fraction; + } - // If that is not the case, cluster it later on. - // Indicate that this is necessary. - *m_clustered = true; - } + + // First check "real" intersection (crosses) + // -> distance zero due to precision, solve it by sorting + if (m_turn_points[left.turn_index].method == method_crosses + && m_turn_points[right.turn_index].method == method_crosses) + { + return consider_relative_order(left, right); } - return sl == sr - ? left.subject->fraction < right.subject->fraction - : sl < sr; + + // If that is not the case, cluster it later on. + // Indicate that this is necessary. + *m_clustered = true; + + return default_order(left, right); } }; |