@@ -506,3 +506,50 @@ int test_main(int, char* [])
506
506
507
507
return 0 ;
508
508
}
509
+
510
+
511
+ #if ! defined(BOOST_GEOMETRY_USE_RESCALING) || defined(BOOST_GEOMETRY_TEST_FAILURES)
512
+
513
+ // failing with rescaling on
514
+
515
+ // https://github.com/boostorg/geometry/issues/630
516
+
517
+ void testIntersection (const std::string& polyString, const std::string& multiPolyString)
518
+ {
519
+ using namespace boost ::geometry;
520
+ using point2d = model::d2::point_xy<double >;
521
+ using polygon = model::polygon<point2d, true , false >;
522
+ using multiPolygon = model::multi_polygon<polygon>;
523
+
524
+ polygon poly;
525
+ multiPolygon multiPoly;
526
+ multiPolygon result;
527
+
528
+ read_wkt (polyString, poly);
529
+ read_wkt (multiPolyString, multiPoly);
530
+
531
+ intersection (multiPoly, poly, result);
532
+
533
+ BOOST_CHECK_GE (area (poly), area (result));
534
+ BOOST_CHECK_EQUAL (!result.empty (), intersects (multiPoly, poly));
535
+ }
536
+
537
+ BOOST_AUTO_TEST_CASE (Test1)
538
+ {
539
+ testIntersection (" POLYGON((-0.3 -0.1475,-0.3 +0.1475,+0.3 +0.1475,+0.3 -0.1475,-0.3 -0.1475))" ,
540
+ " MULTIPOLYGON(((-0.605 +0.1575,+0.254777333596 +1.0172773336,+1.53436796127 -0.262313294074,+0.674590627671 -1.12209062767,-0.605 +0.1575)))" );
541
+ }
542
+
543
+ BOOST_AUTO_TEST_CASE (Test2)
544
+ {
545
+ testIntersection (" POLYGON((-0.3 -0.1475,-0.3 +0.1475,+0.3 +0.1475,+0.3 -0.1475,-0.3 -0.1475))" ,
546
+ " MULTIPOLYGON(((-1.215 +0.7675000000000001,-0.4962799075873666 +1.486220092412633,+0.665763075292561 +0.324177109532706,-0.05295701712007228 -0.3945429828799273,-1.215 +0.7675000000000001)))" );
547
+ }
548
+
549
+ BOOST_AUTO_TEST_CASE (Test3)
550
+ {
551
+ testIntersection (" POLYGON((-0.3 -0.1475,-0.3 +0.1475,+0.3 +0.1475,+0.3 -0.1475,-0.3 -0.1475))" ,
552
+ " MULTIPOLYGON(((-0.9099999999999999 +0.4625,-0.1912799075873667 +1.181220092412633,+0.9707630752925609 +0.01917710953270602,+0.2520429828799277 -0.6995429828799273,-0.9099999999999999 +0.4625)))" );
553
+ }
554
+
555
+ #endif
0 commit comments