Ticket #11783: dist_test.cpp

File dist_test.cpp, 2.1 KB (added by anonymous, 7 years ago)

stand alone c++ source code to test bug

Line 
1#include <iostream>
2#include <fstream>
3#include <string>
4#include <map>
5
6#include <boost/geometry.hpp>
7#include <boost/geometry/geometries/point_xy.hpp>
8#include <boost/geometry/geometries/polygon.hpp>
9
10int main()
11{
12 typedef boost::geometry::model::d2::point_xy<double> point_type;
13 typedef boost::geometry::model::polygon<point_type> polygon_type;
14
15 polygon_type poly, poly2;
16
17 boost::geometry::read_wkt("POLYGON((0.483707939991215 4.773920582819078, 0.5053006295162502 4.848900310429359, 0.5026276157353238 4.926851374195881, 0.47595271806952655 5.000142970012212, 0.42788885209344396 5.061604949484321, 0.36314153156370255 5.1052282121312595, 0.28804795065446004 5.12675006676153, 0.20995692111385858 5.124068426945231, 0.13651026810181627 5.097445647190528, 0.07489571249838214 5.049482920409928, 0.031143980177505432 4.984867693057649, 0.009538656296549554 4.909917885067861, 0.012196499626267798 4.831966193462844, 0.03885948446609647 4.758643661998902, 0.0869192454259704 4.697132255323741, 0.151671837534352 4.653459953523097, 0.22677805366317155 4.63190817924884, 0.30488425540802405 4.634590447230228, 0.37834282146581616 4.661244162857866, 0.43996148046825034 4.709256316654202))", poly);
18 boost::geometry::read_wkt("POLYGON((-1.0557992498764188 4.746036929415318,-1.0993658333477525 4.810856267060861, -1.1608453480495324 4.859088577533509, -1.234220477005859 4.886019279588865, -1.312310562575837 4.889015578303403, -1.3874737831476758 4.867782698965993, -1.452354304963582 4.8243932756221835, -1.5006016515805882 4.763086838460696, -1.5274921589195156 4.689857989799479, -1.530391741605481 4.61187218939475, -1.5090144880022829 4.5367652713717845, -1.465451447333285 4.471894995746168, -1.4039664811460055 4.423618461729835, -1.3305789878636327 4.3966671418069225, -1.2524743477794593 4.393681706260662, -1.177299942608499 4.414952781113644, -1.1124158788230383 4.458393143311671, -1.0641739853613563 4.519743805317727,-1.0372958425476984 4.5929932717763435, -1.0344108128292469 4.670968207668558))",poly2);
19
20 std::cout << "distance: " << boost::geometry::distance(poly, poly2) << std::endl;
21
22 return 0;
23}