Skip to content

Commit

Permalink
TEMPORARY
Browse files Browse the repository at this point in the history
  • Loading branch information
barendgehrels committed Jan 4, 2023
1 parent f92671b commit 13ae8dd
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 10 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,4 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")

endif()

add_subdirectory(tickets)
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@
#include <boost/geometry/util/range.hpp>


# include <boost/geometry/io/wkt/wkt.hpp>

namespace boost { namespace geometry
{

Expand Down Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions test/algorithms/buffer/buffer_linestring_geo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ void test_linestring()
bg::strategy::buffer::geographic_point_circle<Formula> circle(points_per_circle);
bg::strategy::buffer::end_flat end_flat;

// // Misses an intersection point when using thomas
// test_one_geo<linestring, polygon>("opposite", opposite, strategy, side, circle, join_round, end_round, 1658.0, 5.0, settings);
// return;

test_one_geo<linestring, polygon>("simplex_5_8", simplex, strategy, side, circle, join_round, end_flat, 2622.0, 5.0, settings);
test_one_geo<linestring, polygon>("road_5_flat", road, strategy, side, circle, join_round, end_flat, 2644.0, 5.0, settings);
test_one_geo<linestring, polygon>("road_5_25_round", road, strategy, side, circle, join_round, end_round, 2016.0, 5.0, settings, 2.5);
Expand Down
22 changes: 22 additions & 0 deletions test/algorithms/overlay/multi_overlay_cases.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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] =
{
Expand Down Expand Up @@ -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)))",
Expand Down
6 changes: 5 additions & 1 deletion test/algorithms/overlay/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,6 +467,10 @@ void test_all()
using polygon = bg::model::polygon<point_type, Clockwise>;
using multi_polygon = bg::model::multi_polygon<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);

Expand Down Expand Up @@ -514,7 +518,7 @@ void test_integer()

int test_main(int, char* [])
{
test_integer<int, true>();
// test_integer<int, true>();
test_all<double, true>();
return 0;
}
1 change: 1 addition & 0 deletions test/algorithms/set_operations/difference/difference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
37 changes: 29 additions & 8 deletions test/algorithms/set_operations/difference/difference_multi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ void test_all()
template <typename Polygon, typename MultiPolygon>
void test_specific_areal()
{
#if 1
{
// Spikes in a-b and b-a, failure in symmetric difference
ut_settings settings;
Expand Down Expand Up @@ -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<Polygon, MultiPolygon, MultiPolygon>("ticket_10661",
Expand Down Expand Up @@ -518,15 +539,15 @@ int test_main(int, char* [])

test_specific<bg::model::d2::point_xy<int>, false, false>();

#if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
test_all<bg::model::d2::point_xy<float> >();
#endif
// #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE)
// test_all<bg::model::d2::point_xy<float> >();
// #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;
}
18 changes: 17 additions & 1 deletion test/algorithms/set_operations/difference/test_difference.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<G1>::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))
Expand Down

0 comments on commit 13ae8dd

Please sign in to comment.