1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland.
7 // Use, modification and distribution is subject to the Boost Software License,
8 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9 // http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_GEOMETRY_TEST_INTERSECTS_HPP
12 #define BOOST_GEOMETRY_TEST_INTERSECTS_HPP
15 #include <geometry_test_common.hpp>
17 #include <boost/geometry/core/ring_type.hpp>
18 #include <boost/geometry/algorithms/intersects.hpp>
19 #include <boost/geometry/strategies/strategies.hpp>
20 #include <boost/geometry/geometries/ring.hpp>
21 #include <boost/geometry/geometries/polygon.hpp>
23 #include <boost/geometry/io/wkt/read.hpp>
25 #include <boost/geometry/multi/core/geometry_id.hpp>
26 #include <boost/geometry/multi/core/point_order.hpp>
27 #include <boost/geometry/multi/core/ring_type.hpp>
28 #include <boost/geometry/multi/algorithms/covered_by.hpp>
29 #include <boost/geometry/multi/algorithms/detail/point_on_border.hpp>
30 #include <boost/geometry/multi/algorithms/detail/sections/sectionalize.hpp>
31 #include <boost/geometry/multi/algorithms/detail/sections/range_by_section.hpp>
32 #include <boost/geometry/multi/views/detail/range_type.hpp>
33 #include <boost/geometry/multi/geometries/multi_linestring.hpp>
34 #include <boost/geometry/multi/geometries/multi_polygon.hpp>
36 #include <boost/geometry/multi/io/wkt/read.hpp>
38 template <typename Geometry1, typename Geometry2>
39 void test_geometry(std::string const& wkt1,
40 std::string const& wkt2, bool expected)
45 bg::read_wkt(wkt1, geometry1);
46 bg::read_wkt(wkt2, geometry2);
48 bool detected = bg::intersects(geometry1, geometry2);
49 bool detected2 = bg::intersects(geometry2, geometry1);
51 BOOST_CHECK_MESSAGE(detected == expected,
52 "intersects: " << wkt1
54 << " -> Expected: " << expected
55 << " detected: " << detected);
56 BOOST_CHECK_MESSAGE(detected2 == expected,
57 "intersects: " << wkt1
59 << " -> Expected: " << expected
60 << " detected: " << detected2);
64 template <typename Geometry>
65 void test_self_intersects(std::string const& wkt, bool expected)
69 bg::read_wkt(wkt, geometry);
71 bool detected = bg::intersects(geometry);
73 BOOST_CHECK_MESSAGE(detected == expected,
75 << " -> Expected: " << expected
76 << " detected: " << detected);