diff --git a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp index 7db4963c7..b237d1698 100644 --- a/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp +++ b/include/boost/geometry/algorithms/detail/relate/boundary_checker.hpp @@ -51,14 +51,12 @@ public: if ( BoundaryQuery == boundary_front_explicit ) { -// TODO: temporarily disable - //BOOST_ASSERT(this->template is_boundary(pt, sid)); + BOOST_ASSERT(this->template is_boundary(pt, sid)); return true; } else if ( BoundaryQuery == boundary_back_explicit ) { -// TODO: temporarily disable - //BOOST_ASSERT(this->template is_boundary(pt, sid)); + BOOST_ASSERT(this->template is_boundary(pt, sid)); return true; } else if ( BoundaryQuery == boundary_front ) diff --git a/include/boost/geometry/algorithms/detail/relate/linear_linear.hpp b/include/boost/geometry/algorithms/detail/relate/linear_linear.hpp index 3d4653ca7..9bf8473bf 100644 --- a/include/boost/geometry/algorithms/detail/relate/linear_linear.hpp +++ b/include/boost/geometry/algorithms/detail/relate/linear_linear.hpp @@ -469,9 +469,12 @@ struct linear_linear // if it's the first IP then the first point is outside if ( first_in_range ) { + segment_identifier first_seg_id = seg_id; + first_seg_id.segment_index = 0; + // if there is a boundary on the first point if ( boundary_checker.template is_boundary - (range::front(sub_geometry::get(geometry, seg_id)), seg_id) ) + (range::front(sub_geometry::get(geometry, first_seg_id)), first_seg_id) ) { update_result(res); } @@ -601,14 +604,19 @@ struct linear_linear // PREV MAY NOT BE VALID! TurnIt prev = last; --prev; - segment_identifier const& prev_seg_id = prev->operations[OpId].seg_id; - - // if there is a boundary on the last point - if ( boost::size(sub_geometry::get(geometry, prev_seg_id)) > 1 - && boundary_checker.template is_boundary - (range::back(sub_geometry::get(geometry, prev_seg_id)), prev_seg_id) ) + segment_identifier prev_seg_id = prev->operations[OpId].seg_id; + std::size_t points_count = boost::size(sub_geometry::get(geometry, prev_seg_id)); + + if ( points_count > 1 ) { - update_result(res); + prev_seg_id.segment_index = points_count - 2; + + // if there is a boundary on the last point + if ( boundary_checker.template is_boundary + (range::back(sub_geometry::get(geometry, prev_seg_id)), prev_seg_id) ) + { + update_result(res); + } } } }