// Boost.Geometry (aka GGL, Generic Geometry Library) // // Copyright (c) 2007-2012 Barend Gehrels, Amsterdam, the Netherlands. // Copyright (c) 2013 Adam Wulkiewicz, Lodz, Poland. // Use, modification and distribution is subject to the Boost Software License, // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) #include #include #include #include #include #include typedef bg::model::d2::point_xy point_type; typedef bg::model::box box_type; typedef bg::model::nsphere circle_type; template void test_circle(Geometry const& geometry, std::string const& wkt_geometry, bool expected) { circle_type circle(point_type(1.0, 1.0), 3.0); bool detected = bg::disjoint(geometry, circle); BOOST_CHECK_MESSAGE(detected == expected, "disjoint: " << wkt_geometry << " in circle (1,1) with radius 3" << " -> Expected: " << expected << " detected: " << detected); } template void test_circle(std::string const& wkt_geometry, bool expected) { Geometry geometry; bg::read_wkt(wkt_geometry, geometry); test_circle(geometry, wkt_geometry, expected); } int test_main( int , char* [] ) { test_circle("POINT(2 1)", false); test_circle("POINT(12 1)", true); test_circle("BOX(2 1, 4 4)", false); test_circle("BOX(-3 -3, -2 -2)", true); test_circle(circle_type(point_type(4, 4), 2), "CIRCLE(4 4, 2)", false); test_circle(circle_type(point_type(4, 4), 0.5), "CIRCLE(4 4, 0.5)", true); return 0; }