]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/intersects_segment.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
6 // Use, modification and distribution is subject to the Boost Software License,
7 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
8 // http://www.boost.org/LICENSE_1_0.txt)
11 //` Check if two linestrings intersect each other
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
21 // Calculate the intersects of a cartesian polygon
22 typedef boost::geometry::model::d2::point_xy
<double> P
;
23 bg::model::linestring
<P
> line1
, line2
;
25 boost::geometry::read_wkt("linestring(1 1,2 2)", line1
);
26 boost::geometry::read_wkt("linestring(2 1,1 2)", line2
);
28 bool b
= boost::geometry::intersects(line1
, line2
);
30 std::cout
<< "Intersects: " << (b
? "YES" : "NO") << std::endl
;