diff --git a/.mason b/.mason index b03b4f1..47b1f2c 160000 --- a/.mason +++ b/.mason @@ -1 +1 @@ -Subproject commit b03b4f10454ba8a858aaac9f68808dc10de969b1 +Subproject commit 47b1f2c96a19fa08de15acc06ac2e373fc82e1bf diff --git a/include/mapbox/geojsonvt/clip.hpp b/include/mapbox/geojsonvt/clip.hpp index 03f6383..e2d507b 100644 --- a/include/mapbox/geojsonvt/clip.hpp +++ b/include/mapbox/geojsonvt/clip.hpp @@ -137,8 +137,10 @@ class clipper { } else if (bk > k2) { // | ---|--> slice.push_back(intersect(a, b, k2)); slice = newSlice(slices, slice, dist); + + } else if (i == len - 2) { // | --> | + slice.push_back(b); } - // | --> | } } diff --git a/test/test.cpp b/test/test.cpp index 3577d7c..996d54c 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -84,7 +84,7 @@ TEST(Clip, Polylines) { const detail::vt_line_string points1{ { 0, 0 }, { 50, 0 }, { 50, 10 }, { 20, 10 }, { 20, 20 }, { 30, 20 }, { 30, 30 }, { 50, 30 }, { 50, 40 }, { 25, 40 }, { 25, 50 }, { 0, 50 }, - { 0, 60 }, { 25, 60 } }; + { 0, 60 }, { 25, 60 }, { 30, 60 } }; const detail::vt_line_string points2{ { 0, 0 }, { 50, 0 }, { 50, 10 }, { 0, 10 } }; @@ -97,7 +97,7 @@ TEST(Clip, Polylines) { { { 10, 0 }, { 40, 0 } }, { { 40, 10 }, { 20, 10 }, { 20, 20 }, { 30, 20 }, { 30, 30 }, { 40, 30 } }, { { 40, 40 }, { 25, 40 }, { 25, 50 }, { 10, 50 } }, - { { 10, 60 }, { 25, 60 } } } }; + { { 10, 60 }, { 25, 60 }, { 30, 60 } } } }; const detail::vt_geometry expected2{ detail::vt_multi_line_string{ { { 10, 0 }, { 40, 0 } }, { { 40, 10 }, { 10, 10 } } } };