1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands.
5 // Use, modification and distribution is subject to the Boost Software License,
6 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7 // http://www.boost.org/LICENSE_1_0.txt)
9 #ifndef BOOST_GEOMETRY_TEST_INTERSECTS_HPP
10 #define BOOST_GEOMETRY_TEST_INTERSECTS_HPP
13 #include <geometry_test_common.hpp>
15 #include <boost/geometry/core/ring_type.hpp>
16 #include <boost/geometry/algorithms/intersects.hpp>
17 #include <boost/geometry/strategies/strategies.hpp>
18 #include <boost/geometry/geometries/ring.hpp>
19 #include <boost/geometry/geometries/polygon.hpp>
21 #include <boost/geometry/io/wkt/read.hpp>
24 template <typename Geometry1, typename Geometry2>
25 void test_geometry(std::string const& wkt1,
26 std::string const& wkt2, bool expected)
31 bg::read_wkt(wkt1, geometry1);
32 bg::read_wkt(wkt2, geometry2);
34 bool detected = bg::intersects(geometry1, geometry2);
36 BOOST_CHECK_MESSAGE(detected == expected,
37 "intersects: " << wkt1
39 << " -> Expected: " << expected
40 << " detected: " << detected);
44 template <typename Geometry>
45 void test_self_intersects(std::string const& wkt, bool expected)
49 bg::read_wkt(wkt, geometry);
51 bool detected = bg::intersects(geometry);
53 BOOST_CHECK_MESSAGE(detected == expected,
55 << " -> Expected: " << expected
56 << " detected: " << detected);