PageRenderTime 13ms CodeModel.GetById 7ms app.highlight 4ms RepoModel.GetById 1ms app.codeStats 0ms

/Src/Dependencies/Boost/libs/geometry/test/algorithms/convex_hull.cpp

http://hadesmem.googlecode.com/
C++ | 61 lines | 31 code | 15 blank | 15 comment | 0 complexity | 64a97c873b990b81e671195bba35e26f MD5 | raw file
 1// Boost.Geometry (aka GGL, Generic Geometry Library)
 2// Unit Test
 3
 4// Copyright (c) 2007-2011 Barend Gehrels, Amsterdam, the Netherlands.
 5// Copyright (c) 2008-2011 Bruno Lalande, Paris, France.
 6// Copyright (c) 2009-2011 Mateusz Loskot, London, UK.
 7
 8// Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
 9// (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
10
11// Use, modification and distribution is subject to the Boost Software License,
12// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
13// http://www.boost.org/LICENSE_1_0.txt)
14
15#include <cstddef>
16#include <string>
17
18#include <algorithms/test_convex_hull.hpp>
19
20#include <boost/geometry/geometries/geometries.hpp>
21#include <boost/geometry/geometries/point_xy.hpp>
22
23
24template <typename P>
25void test_all()
26{
27    // from sample linestring
28    test_geometry<bg::model::linestring<P> >(
29        "linestring(1.1 1.1, 2.5 2.1, 3.1 3.1, 4.9 1.1, 3.1 1.9)", 5, 4, 3.8);
30
31    // rectangular, with concavity
32    test_geometry<bg::model::polygon<P> >(
33        "polygon((1 1, 1 4, 3 4, 3 3, 4 3, 4 4, 5 4, 5 1, 1 1))",
34                9, 5, 12.0);
35
36    // from sample polygon, with concavity
37    test_geometry<bg::model::polygon<P> >(
38        "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
39        ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
40                12, 8, 5.245);
41
42    test_geometry<bg::model::ring<P> >(
43        "polygon((2.0 1.3, 2.4 1.7, 2.8 1.8, 3.4 1.2, 3.7 1.6,3.4 2.0, 4.1 3.0"
44        ", 5.3 2.6, 5.4 1.2, 4.9 0.8, 2.9 0.7,2.0 1.3))",
45                12, 8, 5.245);
46
47    // Waits for next cycle test_geometry<bg::model::box<P> >("box(0 0,2 2)", 5, 5, 4);
48}
49
50int test_main(int, char* [])
51{
52    //test_all<bg::model::d2::point_xy<int> >();
53    test_all<bg::model::d2::point_xy<float> >();
54    test_all<bg::model::d2::point_xy<double> >();
55
56#if defined(HAVE_TTMATH)
57    test_all<bg::model::d2::point_xy<ttmath_big> >();
58#endif
59
60    return 0;
61}