]>
Commit | Line | Data |
---|---|---|
b32b8144 FG |
1 | // Boost.Geometry (aka GGL, Generic Geometry Library) |
2 | // Unit Test | |
3 | ||
4 | // Copyright (c) 2017 Barend Gehrels, Amsterdam, the Netherlands. | |
5 | ||
6 | // Use, modification and distribution is subject to the Boost Software License, | |
7 | // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at | |
8 | // http://www.boost.org/LICENSE_1_0.txt) | |
9 | ||
10 | #include <test_buffer.hpp> | |
11 | ||
12 | // Short test verifying behavior of explicit ring_type (polygon without holes) | |
13 | // The test buffer_polygon.cpp contains all other tests, also for rings. | |
14 | ||
15 | static std::string const concave_simplex = "POLYGON ((0 0,3 5,3 3,5 3,0 0))"; | |
16 | ||
17 | template <bool Clockwise, typename P> | |
18 | void test_all() | |
19 | { | |
20 | typedef bg::model::ring<P, Clockwise, true> ring_type; | |
21 | typedef bg::model::polygon<P, Clockwise, true> polygon_type; | |
22 | ||
23 | bg::strategy::buffer::join_miter join_miter(10.0); | |
24 | bg::strategy::buffer::join_round join_round(100); | |
25 | bg::strategy::buffer::end_flat end_flat; | |
26 | ||
27 | test_one<ring_type, polygon_type>("concave_simplex", concave_simplex, join_round, end_flat, 14.5616, 0.5); | |
28 | test_one<ring_type, polygon_type>("concave_simplex", concave_simplex, join_miter, end_flat, 16.3861, 0.5); | |
29 | ||
30 | test_one<ring_type, polygon_type>("concave_simplex", concave_simplex, join_round, end_flat, 0.777987, -0.5); | |
31 | test_one<ring_type, polygon_type>("concave_simplex", concave_simplex, join_miter, end_flat, 0.724208, -0.5); | |
32 | } | |
33 | ||
34 | ||
35 | int test_main(int, char* []) | |
36 | { | |
37 | test_all<true, bg::model::point<double, 2, bg::cs::cartesian> >(); | |
38 | #if ! defined(BOOST_GEOMETRY_TEST_ONLY_ONE_TYPE) | |
39 | test_all<false, bg::model::point<double, 2, bg::cs::cartesian> >(); | |
40 | test_all<true, bg::model::point<float, 2, bg::cs::cartesian> >(); | |
41 | test_all<false, bg::model::point<float, 2, bg::cs::cartesian> >(); | |
42 | #endif | |
43 | return 0; | |
44 | } |