]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/libs/geometry/test/algorithms/relational_operations/covered_by/covered_by_sph_geo.cpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / relational_operations / covered_by / covered_by_sph_geo.cpp
index 40229f4ab47ecf396b392d64b9da88788b7111e6..6c8d5853bbd23b51689c94a0eb12f5d5d9124166 100644 (file)
@@ -30,6 +30,18 @@ void test_point_box()
     test_geometry<P, box_t>("POINT(179 1)",  "BOX(170 0, 180 2)", true);
     test_geometry<P, box_t>("POINT(-179 1)", "BOX(170 0, 180 2)", false);
     test_geometry<P, box_t>("POINT(169 1)", "BOX(170 0, 180 2)", false);
+
+    // https://svn.boost.org/trac/boost/ticket/12412
+    test_geometry<P, box_t>("POINT(-0.127592 51.7)", "BOX(-2.08882 51.5034, -0.127592 51.9074)", true);
+    // and related
+    test_geometry<P, box_t>("POINT(-2.08882 51.7)", "BOX(-2.08882 51.5034, -0.127592 51.9074)", true);
+    test_geometry<P, box_t>("POINT(0.127592 51.7)", "BOX(0.127592 51.5034, 2.08882 51.9074)", true);
+    test_geometry<P, box_t>("POINT(2.08882 51.7)", "BOX(0.127592 51.5034, 2.08882 51.9074)", true);
+
+    test_geometry<P, box_t>("POINT(179.08882 1)", "BOX(179.08882 0, 538.127592 2)", true);
+    test_geometry<P, box_t>("POINT(178.127592 1)", "BOX(179.08882 0, 538.127592 2)", true);
+    test_geometry<P, box_t>("POINT(179.08882 1)", "BOX(179.08882 0, 182.127592 2)", true);
+    test_geometry<P, box_t>("POINT(-177.872408 1)", "BOX(179.08882 0, 182.127592 2)", true);
 }
 
 template <typename P>
@@ -54,14 +66,55 @@ void test_box_box()
     test_geometry<box_t, box_t>("BOX(-180 0,-170 1)", "BOX(179 0, 190 1)",  true);
     test_geometry<box_t, box_t>("BOX(-180 0,-170 1)", "BOX(181 0, 190 1)",  false); // invalid?
     test_geometry<box_t, box_t>("BOX(-180 0,-170 1)", "BOX(180 0, 189 1)",  false); // invalid?
+
+    // Related to https://svn.boost.org/trac/boost/ticket/12412
+    test_geometry<box_t, box_t>("BOX(-1.346346 51.6, -0.127592 51.7)", "BOX(-2.08882 51.5034, -0.127592 51.9074)", true);
+    test_geometry<box_t, box_t>("BOX(-2.08882 51.6, -1.346346 51.7)", "BOX(-2.08882 51.5034, -0.127592 51.9074)", true);
+    test_geometry<box_t, box_t>("BOX(0.127592 51.6, 1.346346 51.7)", "BOX(0.127592 51.5034, 2.08882 51.9074)", true);
+    test_geometry<box_t, box_t>("BOX(1.346346 51.6, 2.08882 51.7)", "BOX(0.127592 51.5034, 2.08882 51.9074)", true);
+
+    test_geometry<box_t, box_t>("BOX(179.08882 1, 180.0 1)", "BOX(179.08882 0, 538.127592 2)", true);
+    test_geometry<box_t, box_t>("BOX(177.0 1, 178.127592 1)", "BOX(179.08882 0, 538.127592 2)", true);
+    test_geometry<box_t, box_t>("BOX(179.08882 1, 179.9 1)", "BOX(179.08882 0, 182.127592 2)", true);
+    test_geometry<box_t, box_t>("BOX(-179.9 1, -177.872408 1)", "BOX(179.08882 0, 182.127592 2)", true);
 }
 
+template <typename P>
+void test_point_polygon()
+{
+    typename boost::mpl::if_
+        <
+            boost::is_same<typename bg::cs_tag<P>::type, bg::geographic_tag>,
+            bg::strategy::within::geographic_winding<P>,
+            bg::strategy::within::spherical_winding<P>
+        >::type s;
+
+    typedef bg::model::polygon<P> poly;
+
+    // MySQL report 08.2017
+    test_geometry<P, poly>("POINT(-179 0)",
+                           "POLYGON((0 0, 0 2, 2 0, 0 -2, 0 0))",
+                           false);
+    test_geometry<P, poly>("POINT(-179 0)",
+                           "POLYGON((0 0, 0 2, 2 0, 0 -2, 0 0))",
+                           false,
+                           s);
+
+    test_geometry<P, poly>("POINT(1 0)",
+                           "POLYGON((0 0, 0 2, 2 0, 0 -2, 0 0))",
+                           true);
+    test_geometry<P, poly>("POINT(1 0)",
+                           "POLYGON((0 0, 0 2, 2 0, 0 -2, 0 0))",
+                           true,
+                           s);
+}
 
 template <typename P>
 void test_cs()
 {
     test_point_box<P>();
     test_box_box<P>();
+    test_point_polygon<P>();
 }