mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-27 19:02:12 +00:00
[algorithms][is_simple] fix bug in is_simple(multilinestring): is_simple
was considering a simple closed linestring (living inside a multilinestring) as non-simple because it was wrongly detecting the turn associated with the first and last (closing) point as an unacceptable turn; fix: allow such turns acceptable;
This commit is contained in:
@@ -93,6 +93,19 @@ private:
|
||||
|| geometry::equals(point, range::back(linestring)) );
|
||||
}
|
||||
|
||||
template <typename Point, typename Linestring>
|
||||
static inline bool is_closing_point_of(Point const& point,
|
||||
Linestring const& linestring)
|
||||
{
|
||||
BOOST_ASSERT( boost::size(linestring) > 1 );
|
||||
return
|
||||
geometry::equals(range::front(linestring),
|
||||
range::back(linestring))
|
||||
&&
|
||||
geometry::equals(range::front(linestring), point)
|
||||
;
|
||||
}
|
||||
|
||||
template <typename Linestring1, typename Linestring2>
|
||||
static inline bool have_same_boundary_points(Linestring1 const& ls1,
|
||||
Linestring2 const& ls2)
|
||||
@@ -130,6 +143,13 @@ private:
|
||||
range::at(m_multilinestring,
|
||||
turn.operations[1].seg_id.multi_index);
|
||||
|
||||
if (turn.operations[0].seg_id.multi_index
|
||||
== turn.operations[1].seg_id.multi_index)
|
||||
{
|
||||
BOOST_ASSERT(is_closing_point_of(turn.point, ls1));
|
||||
return true;
|
||||
}
|
||||
|
||||
return
|
||||
is_boundary_point_of(turn.point, ls1)
|
||||
&& is_boundary_point_of(turn.point, ls2)
|
||||
|
||||
Reference in New Issue
Block a user