#include #include #include #include #include namespace bg = ::boost::geometry; typedef bg::model::point point; typedef bg::model::linestring linestring; typedef bg::strategy::distance::pythagoras pythagoras; typedef bg::strategy::distance::projected_point < point,point,void,pythagoras > projected_point; int main() { std::vector points; points.push_back( point(0,0) ); points.push_back( point(10,0) ); linestring ls(points.begin(), points.end()); point q(4,2); std::cout << "point : " << bg::wkt(q) << std::endl; std::cout << "linestring: " << bg::wkt(ls) << std::endl; std::cout << "distance (default strategy): " << bg::distance(q, ls) << std::endl; std::cout << "distance (pythagoras strategy): " << bg::distance(q, ls, pythagoras()) << std::endl; std::cout << "distance (projected point strategy): " << bg::distance(q, ls, projected_point()) << std::endl; return 0; }