]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/doc/src/examples/algorithms/intersects_segment.cpp
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / geometry / doc / src / examples / algorithms / intersects_segment.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // QuickBook Example
3
4 // Copyright (c) 2011-2012 Barend Gehrels, Amsterdam, the Netherlands.
5
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)
9
10 //[intersects
11 //` Check if two linestrings intersect each other
12
13 #include <iostream>
14
15 #include <boost/geometry.hpp>
16 #include <boost/geometry/geometries/linestring.hpp>
17 #include <boost/geometry/geometries/point_xy.hpp>
18
19 int main()
20 {
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;
24
25 boost::geometry::read_wkt("linestring(1 1,2 2)", line1);
26 boost::geometry::read_wkt("linestring(2 1,1 2)", line2);
27
28 bool b = boost::geometry::intersects(line1, line2);
29
30 std::cout << "Intersects: " << (b ? "YES" : "NO") << std::endl;
31
32 return 0;
33 }
34
35 //]
36
37
38 //[intersects_output
39 /*`
40 Output:
41 [pre
42 Intersects: YES
43 ]
44 */
45 //]