unique()は、重複した点を削除する関数です。
#include <iostream> #include <boost/geometry.hpp> #include <boost/geometry/geometries/point_xy.hpp> #include <boost/geometry/geometries/linestring.hpp> #include <boost/assign/list_of.hpp> namespace bg = boost::geometry; typedef bg::model::d2::point_xy<double> point; typedef bg::model::linestring<point> linestring; int main() { linestring line = boost::assign::list_of<point> (0, 0) (1, 1) (1, 1) (3, 3) (1, 1) ; bg::unique(line); std::cout << bg::dsv(line) << std::endl; }
((0, 0), (1, 1), (3, 3), (1, 1))
参照:
unique algorithm