#include #include namespace bg = boost::geometry; int main() { typedef bg::model::point > point; typedef bg::model::box box; point target(10.932501600000000, 59.922640600000001); point pt(10.7535660, 59.9131705); point pmin(10.187599199999999, 59.747306700000003); point pmax(10.753619700000000, 59.917844000000002); box bounding_box(pmin, pmax); bool target_inside_box = bg::covered_by(target, bounding_box); bool point_inside_box = bg::covered_by(pt, bounding_box); // the same for bg::comparable_distance() double dp = bg::distance(target, pt); double db = bg::distance(target, bounding_box); double dm = bg::distance(target, pmax); std::cout << "target inside box = " << (target_inside_box ? "TRUE" : "FALSE") << std::endl; std::cout << "point inside box = " << (point_inside_box ? "TRUE" : "FALSE") << std::endl; std::cout << "target to point = " << dp << std::endl; std::cout << "target to box = " << db << std::endl; std::cout << "target to max = " << dm << std::endl; if (dp > db) std::cout << "ok! the distance to box is smaller" << std::endl; else std::cout << "error! the distance to box should be smaller" << std::endl; return 0; }