1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 
3 // Copyright (c) 2009-2012 Mateusz Loskot, London, UK.
4 
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)
8 //
9 // Multipolygon DP simplification example from the mailing list discussion
10 // about the DP algorithm issue:
11 // http://lists.osgeo.org/pipermail/ggl/2011-September/001533.html
12 
13 #include <boost/geometry.hpp>
14 #include <boost/geometry/strategies/cartesian/distance_pythagoras.hpp>
15 #include <boost/geometry/geometries/point_xy.hpp>
16 using namespace boost::geometry;
17 
main()18 int main()
19 {
20   typedef model::d2::point_xy<double> point_xy;
21 
22   point_xy p1(0.0, 0.0);
23   point_xy p2(5.0, 0.0);
24 
25   // 1) This is direct call to Pythagoras algo
26   typedef strategy::distance::pythagoras<point_xy, point_xy, double> strategy1_type;
27   strategy1_type strategy1;
28   strategy1_type ::calculation_type d1 = strategy1.apply(p1, p2);
29 
30   // 2) This is what is effectively called by simplify
31   typedef strategy::distance::comparable::pythagoras<point_xy, point_xy, double> strategy2_type;
32   strategy2_type strategy2;
33   strategy2_type::calculation_type d2 = strategy2.apply(p1, p2);
34 
35   return 0;
36 }
37