diff --git a/CMakeLists.txt b/CMakeLists.txt index 49fc4b6005..07e25e06af 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -55,3 +55,4 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt") endif() +add_subdirectory(tickets) diff --git a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp index d087e604b7..d9163e6c75 100644 --- a/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp +++ b/include/boost/geometry/algorithms/detail/buffer/buffered_piece_collection.hpp @@ -62,6 +62,8 @@ #include +# include + namespace boost { namespace geometry { @@ -477,6 +479,14 @@ struct buffered_piece_collection > visitor(m_pieces, offsetted_rings, m_turns, m_strategy, m_robust_policy); +#if 0 +std::cout << "OFFSETTED RINGS" << std::endl << std::setprecision(20); +for (const auto& ring : offsetted_rings) +{ + std::cout << geometry::wkt(ring) << std::endl; +} +#endif + detail::sectionalize::enlarge_sections(monotonic_sections, m_strategy); geometry::partition diff --git a/test/algorithms/buffer/buffer_linestring_geo.cpp b/test/algorithms/buffer/buffer_linestring_geo.cpp index 68fe9f2c07..40a0edbb79 100644 --- a/test/algorithms/buffer/buffer_linestring_geo.cpp +++ b/test/algorithms/buffer/buffer_linestring_geo.cpp @@ -50,6 +50,10 @@ void test_linestring() bg::strategy::buffer::geographic_point_circle circle(points_per_circle); bg::strategy::buffer::end_flat end_flat; + // // Misses an intersection point when using thomas + // test_one_geo("opposite", opposite, strategy, side, circle, join_round, end_round, 1658.0, 5.0, settings); + // return; + test_one_geo("simplex_5_8", simplex, strategy, side, circle, join_round, end_flat, 2622.0, 5.0, settings); test_one_geo("road_5_flat", road, strategy, side, circle, join_round, end_flat, 2644.0, 5.0, settings); test_one_geo("road_5_25_round", road, strategy, side, circle, join_round, end_round, 2016.0, 5.0, settings, 2.5); diff --git a/test/algorithms/overlay/multi_overlay_cases.hpp b/test/algorithms/overlay/multi_overlay_cases.hpp index 45fc7b532c..ed9f1a6085 100644 --- a/test/algorithms/overlay/multi_overlay_cases.hpp +++ b/test/algorithms/overlay/multi_overlay_cases.hpp @@ -1542,6 +1542,14 @@ static std::string issue_869_c[2] = "MULTIPOLYGON(((10 10,10 70,50 70,50 90,70 90,70 70,90 70,90 50,70 50,70 10,10 10)))" }; +// For difference +static std::string issue_893[2] = +{ + "MULTIPOLYGON(((-9133.3885344331684, 3976.3162451998137,-6748.2449169873034 -5735.0734557728138,12359.886942916415 -1042.0645095456412,5126.3084924076147 2226.9708710750697,-1604.5619839035633 573.85084904357439,-9133.3885344331684 3976.3162451998137)))", + "MULTIPOLYGON(((-3228.4265340177531 1307.7159344890201,-4500.2645033380131 1882.4913860267370,-4294.7752070657516 1045.8178117890784,-3228.4265340177531 1307.7159344890201)))" +}; + + // For difference static std::string issue_888_34[2] = { @@ -1574,6 +1582,20 @@ static std::string issue_930[2] = "MULTIPOLYGON(((-10 2,5 3,20 2,-10 2)))" }; +// For difference / integer +static std::string issue_1034[2] = +{ + "MULTIPOLYGON(((3232 2413,2136 2646,3232 2412,3232 2413)),((3232 2532,3232 2856,1031 2856,1031 1056,3232 1056,3232 2221,2136 2328,1032 1212,1032 1458,1032 1764,2136 2790,3232 2532)))", + "MULTIPOLYGON(((1032 2130,1032 1764,2052 2712,1032 2130)),((3234 2580,2558 2690,3234 2532,3234 2580)),((2558 2690,2136 2790,2052 2712,2136 2760,2558 2690)))" +}; + +// Exactly the same polygon, but all coordinates * 10 +static std::string issue_1034_10[2] = +{ + "MULTIPOLYGON(((32320 24130,21360 26460,32320 24120,32320 24130)),((32320 25320,32320 28560,10310 28560,10310 10560,32320 10560,32320 22210,21360 23280,10320 12120,10320 14580,10320 17640,21360 27900,32320 25320)))", + "MULTIPOLYGON(((10320 21300,10320 17640,20520 27120,10320 21300)),((32340 25800,25580 26900,32340 25320,32340 25800)),((25580 26900,21360 27900,20520 27120,21360 27600,25580 26900)))" +}; + static std::string bug_21155501[2] = { "MULTIPOLYGON(((-8.3935546875 27.449790329784214,4.9658203125 18.729501999072138,11.8212890625 23.563987128451217,9.7119140625 25.48295117535531,9.8876953125 31.728167146023935,8.3056640625 32.99023555965106,8.5693359375 37.16031654673677,-1.8896484375 35.60371874069731,-0.5712890625 32.02670629333614,-8.9208984375 29.458731185355344,-8.3935546875 27.449790329784214)))", diff --git a/test/algorithms/overlay/overlay.cpp b/test/algorithms/overlay/overlay.cpp index 8162a848c3..89445adfc6 100644 --- a/test/algorithms/overlay/overlay.cpp +++ b/test/algorithms/overlay/overlay.cpp @@ -467,6 +467,10 @@ void test_all() using polygon = bg::model::polygon; using multi_polygon = bg::model::multi_polygon; + TEST_DIFFERENCE_A(issue_893, 5.58, 5, 0); + TEST_DIFFERENCE_B(issue_893, 2.58, 4, 0); + return; + TEST_UNION(case_multi_simplex, 14.58, 1, 0); TEST_INTERSECTION(case_multi_simplex, 6.42, 2, 0); @@ -514,7 +518,7 @@ void test_integer() int test_main(int, char* []) { - test_integer(); + // test_integer(); test_all(); return 0; } diff --git a/test/algorithms/set_operations/difference/difference.cpp b/test/algorithms/set_operations/difference/difference.cpp index fb38427199..c84c5fa77a 100644 --- a/test/algorithms/set_operations/difference/difference.cpp +++ b/test/algorithms/set_operations/difference/difference.cpp @@ -66,6 +66,7 @@ void test_all() 1, 5, 8.0, 1, 5, 8.0); + if (false) { // Sym difference works, but expectations are different for rescaling ut_settings settings; diff --git a/test/algorithms/set_operations/difference/difference_multi.cpp b/test/algorithms/set_operations/difference/difference_multi.cpp index d1d89a99ce..71623e7666 100644 --- a/test/algorithms/set_operations/difference/difference_multi.cpp +++ b/test/algorithms/set_operations/difference/difference_multi.cpp @@ -431,6 +431,7 @@ void test_all() template void test_specific_areal() { + #if 1 { // Spikes in a-b and b-a, failure in symmetric difference ut_settings settings; @@ -474,6 +475,26 @@ void test_specific_areal() 2); } + #endif + +#if 0 + { + // Issue 1034 (Volker) + // The output is invalid. Doing the same intersection with coordinates 10 times larger, + // the output is valid. Somehow the integer coordinates are intersected well (probably) + // but because of rounding to the integer grid, invalidities can appear. + ut_settings settings; + settings.sym_difference = false; + settings.set_test_validity(true); + TEST_DIFFERENCE_WITH(0, 1, issue_1034, + 2, 2775740.5, + 3, 7901.5, + 2); + TEST_DIFFERENCE_WITH(0, 1, issue_1034_10, 4, 277638639, 3, 780674, 2); + } + + return; +#endif { const std::string a_min_b = test_one("ticket_10661", @@ -518,15 +539,15 @@ int test_main(int, char* []) test_specific, false, false>(); -#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) - test_all >(); -#endif +// #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) +// test_all >(); +// #endif -#if defined(BOOST_GEOMETRY_TEST_FAILURES) - // Not yet fully tested for float. - // The difference algorithm can generate (additional) slivers - BoostGeometryWriteExpectedFailures(24, 11, 21, 7); -#endif +// #if defined(BOOST_GEOMETRY_TEST_FAILURES) +// // Not yet fully tested for float. +// // The difference algorithm can generate (additional) slivers +// BoostGeometryWriteExpectedFailures(24, 11, 21, 7); +// #endif return 0; } diff --git a/test/algorithms/set_operations/difference/test_difference.hpp b/test/algorithms/set_operations/difference/test_difference.hpp index 3ec8dfa24d..8afff515b3 100644 --- a/test/algorithms/set_operations/difference/test_difference.hpp +++ b/test/algorithms/set_operations/difference/test_difference.hpp @@ -212,7 +212,23 @@ std::string test_difference(std::string const& caseid, G1 const& g1, G2 const& g std::ostringstream return_string; return_string << bg::wkt(result); - typename bg::default_area_result::type const area = bg::area(result); + auto const area = bg::area(result); + +#if 0 + // DEBUG + for (const auto& pol : result) + { + for (const auto& ring : bg::interior_rings(pol)) + { + std::cout << " RING area=" << bg::area(ring) + << " valid=" << bg::is_valid(ring) + << std::endl; + } + std::cout << " area=" << bg::area(pol) + << " valid=" << bg::is_valid(pol) + << std::endl; + } +#endif #if ! defined(BOOST_GEOMETRY_NO_BOOST_TEST) if (settings.test_validity_of_diff(dtype))