]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/geometry/test/algorithms/convex_hull_multi.cpp
import quincy beta 17.1.0
[ceph.git] / ceph / src / boost / libs / geometry / test / algorithms / convex_hull_multi.cpp
1 // Boost.Geometry (aka GGL, Generic Geometry Library)
2 // Unit Test
3
4 // Copyright (c) 2007-2015 Barend Gehrels, Amsterdam, the Netherlands.
5 // Copyright (c) 2008-2015 Bruno Lalande, Paris, France.
6 // Copyright (c) 2009-2015 Mateusz Loskot, London, UK.
7
8 // This file was modified by Oracle on 2014, 2015.
9 // Modifications copyright (c) 2014-2015 Oracle and/or its affiliates.
10
11 // Contributed and/or modified by Adam Wulkiewicz, on behalf of Oracle
12
13 // Parts of Boost.Geometry are redesigned from Geodan's Geographic Library
14 // (geolib/GGL), copyright (c) 1995-2010 Geodan, Amsterdam, the Netherlands.
15
16 // Use, modification and distribution is subject to the Boost Software License,
17 // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt)
19
20 #include <cstddef>
21 #include <iterator>
22 #include <string>
23
24 #include <algorithms/test_convex_hull.hpp>
25
26 #include <boost/geometry/geometries/geometries.hpp>
27 #include <boost/geometry/geometries/point_xy.hpp>
28
29 #include <boost/geometry/core/point_order.hpp>
30 #include <boost/geometry/core/point_type.hpp>
31
32 #include <boost/geometry/views/detail/range_type.hpp>
33
34 #include <boost/geometry/algorithms/detail/for_each_range.hpp>
35
36 #include <boost/geometry/geometries/multi_point.hpp>
37 #include <boost/geometry/geometries/multi_linestring.hpp>
38 #include <boost/geometry/geometries/multi_polygon.hpp>
39
40
41
42
43 template <typename P>
44 void test_all()
45 {
46 typedef bg::model::multi_point<P> mp;
47 typedef bg::model::multi_linestring<bg::model::linestring<P> > ml;
48 typedef bg::model::multi_polygon<bg::model::polygon<P> > mpoly;
49
50 // All points below in upper-points and lower-points
51 test_geometry<mp>("MULTIPOINT((0 0),(5 0),(1 1),(4 1))", 0, 5, 4.0);
52 test_geometry<mp>("MULTIPOINT((0 1),(5 1),(1 0),(4 0))", 0, 5, 4.0);
53
54 // All points in vertical line (this delivers an empty polygon with 3 points and closing point for closed)
55 test_geometry<mp>("MULTIPOINT((1 0),(5 0),(3 0),(4 0),(2 0))", 0, 4, 0.0);
56
57 // One point only
58 test_geometry<mp>("MULTIPOINT((1 0))", 0, 4, 0.0);
59
60 // Problem of 6019, reproduced by the convex hull robustness test:
61 test_geometry<mp>("MULTIPOINT((2 9),(1 3),(9 4),(1 1),(1 0),(7 9),(2 5),(3 7),(3 6),(2 4))",
62 0, 6, 48.0);
63
64 // Ticket 6019:
65 test_geometry<mp>("MULTIPOINT((0 53),(0 103),(0 53),(0 3),(0 3),(0 0),(1 0),(1 1),(2 1),(2 0),(2 0),(2 0),(3 0),(3 1),(4 1),(4 0),(5 0),(0 3),(10 3),(10 2),(10 2),(10 2),(5 2),(5 0),(5 0),(55 0),(105 0))",
66 0, 4, 5407.5);
67 // Ticket 6021:
68 test_geometry<mp>("multipoint((0 53), (0 103), (1 53))", 3, 4, 25);
69
70 test_geometry<mp>("multipoint((1.1 1.1), (2.5 2.1), (3.1 3.1), (4.9 1.1), (3.1 1.9))", 5, 4, 3.8);
71 test_geometry<ml>("multilinestring((2 4, 3 4, 3 5), (4 3,4 4,5 4))", 6, 5, 3.0);
72 test_geometry<mpoly>("multipolygon(((1 4,1 6,2 5,3 5,4 6,4 4,1 4)), ((4 2,4 3,6 3,6 2,4 2)))", 12, 7, 14.0);
73
74 test_empty_input<mp>();
75 test_empty_input<ml>();
76 test_empty_input<mpoly>();
77 }
78
79
80 int test_main(int, char* [])
81 {
82 //test_all<bg::model::d2::point_xy<int> >();
83 //test_all<bg::model::d2::point_xy<float> >();
84 test_all<bg::model::d2::point_xy<double> >();
85
86 return 0;
87 }