mirror of
https://github.com/boostorg/geometry.git
synced 2026-02-14 00:42:09 +00:00
Adaptions to test with respect to new namespace model Removed GMP/CLN and, where it was present, replaced by TTMATH Small fix in comparable_distance test All testfiles use bg as alias now [SVN r66811]
56 lines
1.4 KiB
C++
56 lines
1.4 KiB
C++
// Boost.Geometry (aka GGL, Generic Geometry Library)
|
|
//
|
|
// Copyright Barend Gehrels, Geodan B.V. Amsterdam, the Netherlands.
|
|
// 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 <geometry_test_common.hpp>
|
|
|
|
#include <boost/geometry/extensions/nsphere/nsphere.hpp>
|
|
|
|
#include <boost/geometry/geometries/geometries.hpp>
|
|
#include <boost/geometry/strategies/strategies.hpp>
|
|
|
|
#include <boost/geometry/extensions/gis/io/wkt/read_wkt.hpp>
|
|
|
|
|
|
template <typename Geometry>
|
|
void test_circle(std::string const& wkt_geometry, bool expected)
|
|
{
|
|
bg::model::circle circle;
|
|
bg::assign(circle, 1.0, 1.0, 3.0);
|
|
|
|
Geometry geometry;
|
|
bg::read_wkt(wkt_geometry, geometry);
|
|
|
|
bool detected = bg::within(geometry, circle);
|
|
|
|
BOOST_CHECK_MESSAGE(detected == expected,
|
|
"within: " << wkt_geometry
|
|
<< " in circle (1,1) with radius 3"
|
|
<< " -> Expected: " << expected
|
|
<< " detected: " << detected);
|
|
}
|
|
|
|
|
|
|
|
|
|
template <typename P>
|
|
void test_circles()
|
|
{
|
|
test_circle<P>("POINT(2 1)", true);
|
|
test_circle<P>("POINT(12 1)", false);
|
|
|
|
test_circle<bg::model::linestring<P> >("LINESTRING(1 1,2 1,2 2)", true);
|
|
test_circle<bg::model::linestring<P> >("LINESTRING(1 1,2 1,2 2,10 10)", false);
|
|
}
|
|
|
|
|
|
int test_main( int , char* [] )
|
|
{
|
|
test_circles<bg::model::point_xy<double> >();
|
|
|
|
return 0;
|
|
}
|