1 | #include <boost/geometry.hpp>
|
---|
2 | #include <boost/geometry/geometries/polygon.hpp>
|
---|
3 | #include <boost/geometry/geometries/adapted/boost_tuple.hpp>
|
---|
4 | #include <boost/geometry/geometries/point_xy.hpp>
|
---|
5 | #include <iostream>
|
---|
6 | #include <vector>
|
---|
7 |
|
---|
8 | BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
|
---|
9 |
|
---|
10 | int main()
|
---|
11 | {
|
---|
12 | typedef boost::tuple<double, double> point;
|
---|
13 | boost::geometry::model::multi_point<point> my_multipoint;
|
---|
14 |
|
---|
15 | // 105 points
|
---|
16 | boost::geometry::append(my_multipoint, point( -797.90716690718341, -743.43957664112133 ));
|
---|
17 | boost::geometry::append(my_multipoint, point( -795.22162289526409, -727.99240467525078 ));
|
---|
18 | boost::geometry::append(my_multipoint, point( -790.46173098582653, -701.28876092851795 ));
|
---|
19 | boost::geometry::append(my_multipoint, point( -790.33976574526014, -700.62296627345972 ));
|
---|
20 | boost::geometry::append(my_multipoint, point( -790.26187892902442, -700.19779085548635 ));
|
---|
21 | boost::geometry::append(my_multipoint, point( -789.23540411077852, -694.59437965103302 ));
|
---|
22 | boost::geometry::append(my_multipoint, point( -787.83554997170233, -686.95273250936839 ));
|
---|
23 | boost::geometry::append(my_multipoint, point( -514.06726216482116, 806.27949673949558 ));
|
---|
24 | boost::geometry::append(my_multipoint, point( -509.36967991522408, 831.76499172739125 ));
|
---|
25 | boost::geometry::append(my_multipoint, point( -506.75807734171445, 834.00456288940575 ));
|
---|
26 | boost::geometry::append(my_multipoint, point( -337.89169177244594, 835.53825334857891 ));
|
---|
27 | boost::geometry::append(my_multipoint, point( -337.84865664266141, 822.44389056700004 ));
|
---|
28 | boost::geometry::append(my_multipoint, point( -337.84312909130801, 80.630216730473649 ));
|
---|
29 | boost::geometry::append(my_multipoint, point( -337.84312909130807, 80.63021673236176 ));
|
---|
30 | boost::geometry::append(my_multipoint, point( -337.8339573083814, 769.32163390153153 ));
|
---|
31 | boost::geometry::append(my_multipoint, point( -337.80238402253292, 785.04525910924269 ));
|
---|
32 | boost::geometry::append(my_multipoint, point( -337.67480532612205, 826.5094981125452 ));
|
---|
33 | boost::geometry::append(my_multipoint, point( -336.53644831680521, 827.27040221811501 ));
|
---|
34 | boost::geometry::append(my_multipoint, point( -335.46413976943887, 820.00558741272278 ));
|
---|
35 | boost::geometry::append(my_multipoint, point( -335.39986207205209, 796.45752002319466 ));
|
---|
36 | boost::geometry::append(my_multipoint, point( -335.39578977808742, 79.550528953457956 ));
|
---|
37 | boost::geometry::append(my_multipoint, point( -335.39578977808748, 79.550528962120211 ));
|
---|
38 | boost::geometry::append(my_multipoint, point( -335.05585592953452, 800.57532887869263 ));
|
---|
39 | boost::geometry::append(my_multipoint, point( -334.85279105122828, 807.0289157892206 ));
|
---|
40 | boost::geometry::append(my_multipoint, point( -334.00050267761219, 826.230955331063 ));
|
---|
41 | boost::geometry::append(my_multipoint, point( -333.92847236692313, 826.71658830980061 ));
|
---|
42 | boost::geometry::append(my_multipoint, point( -333.76942412227828, 827.1473331779481 ));
|
---|
43 | boost::geometry::append(my_multipoint, point( -333.53708769605333, 827.48600615602084 ));
|
---|
44 | boost::geometry::append(my_multipoint, point( -333.52533372011845, 98.533479510515235 ));
|
---|
45 | boost::geometry::append(my_multipoint, point( -333.5236320644247, -219.91404275572708 ));
|
---|
46 | boost::geometry::append(my_multipoint, point( -333.52363206442476, -219.91404275071523 ));
|
---|
47 | boost::geometry::append(my_multipoint, point( -333.5145050872307, 786.19796221274794 ));
|
---|
48 | boost::geometry::append(my_multipoint, point( -333.37643803114725, 822.11639993010374 ));
|
---|
49 | boost::geometry::append(my_multipoint, point( -333.25151939634759, 827.70337146859163 ));
|
---|
50 | boost::geometry::append(my_multipoint, point( -332.93737072937586, 827.78066519723427 ));
|
---|
51 | boost::geometry::append(my_multipoint, point( -332.6217604260134, 827.71121500223546 ));
|
---|
52 | boost::geometry::append(my_multipoint, point( -331.12244825824973, 824.51276440461754 ));
|
---|
53 | boost::geometry::append(my_multipoint, point( -331.08725507658625, 822.23947706478282 ));
|
---|
54 | boost::geometry::append(my_multipoint, point( -331.07085017092896, 116.97037612943245 ));
|
---|
55 | boost::geometry::append(my_multipoint, point( -331.07073240358659, 78.8398891226675 ));
|
---|
56 | boost::geometry::append(my_multipoint, point( -331.07073240358665, 78.839889128809546 ));
|
---|
57 | boost::geometry::append(my_multipoint, point( -331.0596700835942, 818.18472270000677 ));
|
---|
58 | boost::geometry::append(my_multipoint, point( -331.04513091163921, 823.44725839699561 ));
|
---|
59 | boost::geometry::append(my_multipoint, point( -329.92579891878466, 826.46595319008668 ));
|
---|
60 | boost::geometry::append(my_multipoint, point( -327.2600074516439, 832.78027798811002 ));
|
---|
61 | boost::geometry::append(my_multipoint, point( -302.60107259893425, 835.82954434354372 ));
|
---|
62 | boost::geometry::append(my_multipoint, point( -111.03257380226995, 837.45798976157232 ));
|
---|
63 | boost::geometry::append(my_multipoint, point( 501.41481051435198, 842.49069378124807 ));
|
---|
64 | boost::geometry::append(my_multipoint, point( 572.43405315774919, 842.86123160354134 ));
|
---|
65 | boost::geometry::append(my_multipoint, point( 599.93879237178385, 830.40056768320176 ));
|
---|
66 | boost::geometry::append(my_multipoint, point( 608.49896614863485, 826.44663231674406 ));
|
---|
67 | boost::geometry::append(my_multipoint, point( 630.10491926022303, 815.56490207288186 ));
|
---|
68 | boost::geometry::append(my_multipoint, point( 640.72086116967637, 732.71159553227301 ));
|
---|
69 | boost::geometry::append(my_multipoint, point( 541.75969635004913, -759.48048094413593 ));
|
---|
70 | boost::geometry::append(my_multipoint, point( 533.92858414961688, -802.48515050950027 ));
|
---|
71 | boost::geometry::append(my_multipoint, point( 528.27586502389477, -833.19576594350247 ));
|
---|
72 | boost::geometry::append(my_multipoint, point( 524.8024711779193, -850.24784658353565 ));
|
---|
73 | boost::geometry::append(my_multipoint, point( 375.66053547345166, -851.31173946912065 ));
|
---|
74 | boost::geometry::append(my_multipoint, point( 334.23831586428628, -851.4006986393515 ));
|
---|
75 | boost::geometry::append(my_multipoint, point( 323.54469242467235, -848.37472112451201 ));
|
---|
76 | boost::geometry::append(my_multipoint, point( 321.11271545594326, -847.19784248686733 ));
|
---|
77 | boost::geometry::append(my_multipoint, point( 319.55610600537477, -843.57474889648245 ));
|
---|
78 | boost::geometry::append(my_multipoint, point( 319.08141043802328, -804.82208413760839 ));
|
---|
79 | boost::geometry::append(my_multipoint, point( 319.01914360517787, -675.54125362689115 ));
|
---|
80 | boost::geometry::append(my_multipoint, point( 319.01699893964826, -476.73320068471332 ));
|
---|
81 | boost::geometry::append(my_multipoint, point( 319.01692904272909, -101.51828099435119 ));
|
---|
82 | boost::geometry::append(my_multipoint, point( 319.01692904272915, -101.51828099730557 ));
|
---|
83 | boost::geometry::append(my_multipoint, point( 319.00506000036955, -746.57142200626981 ));
|
---|
84 | boost::geometry::append(my_multipoint, point( 318.99963208543159, -756.36120795656132 ));
|
---|
85 | boost::geometry::append(my_multipoint, point( 318.98309119498742, -772.6307992003384 ));
|
---|
86 | boost::geometry::append(my_multipoint, point( 318.8107166139207, -805.08172565760128 ));
|
---|
87 | boost::geometry::append(my_multipoint, point( 318.5487374526449, -837.69083312539442 ));
|
---|
88 | boost::geometry::append(my_multipoint, point( 317.79405997847948, -843.28564818624079 ));
|
---|
89 | boost::geometry::append(my_multipoint, point( 315.55799430347736, -843.93521656527503 ));
|
---|
90 | boost::geometry::append(my_multipoint, point( 302.72058590873348, -847.63740854811806 ));
|
---|
91 | boost::geometry::append(my_multipoint, point( 274.48528564179617, -850.55887542220353 ));
|
---|
92 | boost::geometry::append(my_multipoint, point( 264.75184382335334, -845.97817022391337 ));
|
---|
93 | boost::geometry::append(my_multipoint, point( 264.36257215171912, -844.36043227782602 ));
|
---|
94 | boost::geometry::append(my_multipoint, point( 264.25858632793324, -828.47882176995711 ));
|
---|
95 | boost::geometry::append(my_multipoint, point( 264.17512517309098, -724.65453309905922 ));
|
---|
96 | boost::geometry::append(my_multipoint, point( 264.16917987210189, -699.68277708052722 ));
|
---|
97 | boost::geometry::append(my_multipoint, point( 264.16633120973182, -297.18911797849876 ));
|
---|
98 | boost::geometry::append(my_multipoint, point( 264.16633120973188, -297.18911798145319 ));
|
---|
99 | boost::geometry::append(my_multipoint, point( 264.16206739125943, -751.37417925730676 ));
|
---|
100 | boost::geometry::append(my_multipoint, point( 264.11783289495128, -828.0291331930365 ));
|
---|
101 | boost::geometry::append(my_multipoint, point( 263.89230914405806, -833.73191258122506 ));
|
---|
102 | boost::geometry::append(my_multipoint, point( 262.86325998800237, -841.16198169473614 ));
|
---|
103 | boost::geometry::append(my_multipoint, point( 261.66661064514955, -843.11517046728568 ));
|
---|
104 | boost::geometry::append(my_multipoint, point( 261.31961894542701, -843.0657526960789 ));
|
---|
105 | boost::geometry::append(my_multipoint, point( 260.9034444773061, -838.80039823048628 ));
|
---|
106 | boost::geometry::append(my_multipoint, point( 260.28071303182497, -824.96583968484015 ));
|
---|
107 | boost::geometry::append(my_multipoint, point( 260.08813669851213, -805.30901833729865 ));
|
---|
108 | boost::geometry::append(my_multipoint, point( 259.82605511812193, -757.62536924591166 ));
|
---|
109 | boost::geometry::append(my_multipoint, point( 259.82262372438947, -290.49568327311431 ));
|
---|
110 | boost::geometry::append(my_multipoint, point( 259.82262372438953, -290.4956832760688 ));
|
---|
111 | boost::geometry::append(my_multipoint, point( 259.81744287440932, -805.56865985729132 ));
|
---|
112 | boost::geometry::append(my_multipoint, point( 259.67576686965378, -824.37379268672873 ));
|
---|
113 | boost::geometry::append(my_multipoint, point( 259.55546371313363, -838.17776732508469 ));
|
---|
114 | boost::geometry::append(my_multipoint, point( 259.31344112408544, -849.58150341179066 ));
|
---|
115 | boost::geometry::append(my_multipoint, point( 248.38140362121248, -852.31717283431419 ));
|
---|
116 | boost::geometry::append(my_multipoint, point( -554.33437860251911, -859.2725338959458 ));
|
---|
117 | boost::geometry::append(my_multipoint, point( -565.75258656146957, -854.62812152144318 ));
|
---|
118 | boost::geometry::append(my_multipoint, point( -787.26712120149818, -752.40146400728577 ));
|
---|
119 | boost::geometry::append(my_multipoint, point( -795.22395741253774, -748.19204317574668 ));
|
---|
120 | boost::geometry::append(my_multipoint, point( -797.90716690718341, -743.43957664112133 ));
|
---|
121 |
|
---|
122 |
|
---|
123 | boost::geometry::model::polygon<point> hull;
|
---|
124 | boost::geometry::convex_hull (my_multipoint, hull);
|
---|
125 |
|
---|
126 | vector<boost::tuples::tuple<double, double> >::iterator it;
|
---|
127 | for (it = hull.outer().begin(); it != hull.outer().end(); ++it)
|
---|
128 | std::cout << std::setprecision(17) << boost::geometry::get<0>(*it) << ", " << boost::geometry::get<1>(*it) << std::endl;
|
---|
129 |
|
---|
130 | std::cout << "Number of points in hull: " << hull.outer().size() << std::endl;
|
---|
131 |
|
---|
132 | return 0;
|
---|
133 | }
|
---|