18 Haziran 2017 Pazar

geometry correct metodu

Giriş
Şu satırı dahil ederiz.
#include <boost/geometry.hpp>
Algoritma şu satırda
#include <boost/geometry/algorithms/intersection.hpp>
LineString
Şöyle yaparız.
using value_type       = double;
using cs_type          = bg::cs::cartesian;
using point_type       = bg::model::point<value_type, 2, cs_type>;

using line_string_type = bg::model::linestring<point_type>;

line_string_type line;
line.push_back(point_type{13.37688020921095, 53.66231710654281});
line.push_back(point_type{13.3857295713429,  53.6636835518369});
line.push_back(point_type{13.39213495232734, 53.66501934623722});
line.push_back(point_type{13.39719615524716, 53.66546436809296});
line.push_back(point_type{13.40724694386097, 53.66240690770171});
bg::correct(line);

Polygon
Elimizde dolu bir polygon olsun
using PointType = boost::geometry::model::d2::point_xy <double>;
using PolygonType = boost::geometry::model::polygon <PointType>;

// Construct
PolygonType polygon;
...
Şöyle yaparız.
boost::geometry::correct (polygon);

Hiç yorum yok:

Yorum Gönder