From 2e9eedd4ea28bb4ab5e5a139aa387487ff91c806 Mon Sep 17 00:00:00 2001 From: Barend Gehrels Date: Wed, 4 Mar 2015 12:31:59 +0100 Subject: [PATCH] [buffer][test] Add cases for various miter limits --- test/algorithms/buffer/polygon_buffer.cpp | 57 +++++++++++++++++++++-- 1 file changed, 52 insertions(+), 5 deletions(-) diff --git a/test/algorithms/buffer/polygon_buffer.cpp b/test/algorithms/buffer/polygon_buffer.cpp index a683e88f6..cc108a489 100644 --- a/test/algorithms/buffer/polygon_buffer.cpp +++ b/test/algorithms/buffer/polygon_buffer.cpp @@ -532,18 +532,65 @@ void test_all() { - bg::strategy::buffer::join_round join_round12(12); + using bg::strategy::buffer::join_round; + using bg::strategy::buffer::join_miter; buffer_custom_side_strategy side_strategy; bg::strategy::buffer::point_circle point_strategy; - bg::strategy::buffer::distance_symmetric + typedef bg::strategy::buffer::distance_symmetric < typename bg::coordinate_type

::type - > distance_strategy(1.0); + > distance; - test_with_custom_strategies("sharp_triangle", + test_with_custom_strategies("sharp_triangle_j12", sharp_triangle, - join_round12, end_flat, distance_strategy, side_strategy, point_strategy, + join_round(12), end_flat, distance(1.0), side_strategy, point_strategy, 31.0721); + // Test very various number of points (min is 3) + test_with_custom_strategies("sharp_triangle_j2", + sharp_triangle, + join_round(2), end_flat, distance(1.0), side_strategy, point_strategy, + 29.2865); + test_with_custom_strategies("sharp_triangle_j5", + sharp_triangle, + join_round(5), end_flat, distance(1.0), side_strategy, point_strategy, + 30.2291); + +#if defined(BOOST_GEOMETRY_BUFFER_INCLUDE_FAILING_TESTS) + test_with_custom_strategies("sharp_triangle_j36", + sharp_triangle, + join_round(36), end_flat, distance(1.0), side_strategy, point_strategy, + 29.9999); // TBD + test_with_custom_strategies("sharp_triangle_j360", + sharp_triangle, + join_round(360), end_flat, distance(1.0), side_strategy, point_strategy, + 29.9999); // TBD + test_with_custom_strategies("sharp_triangle_j3600", + sharp_triangle, + join_round(3600), end_flat, distance(1.0), side_strategy, point_strategy, + 29.9999); // TBD +#endif + + // Test with various miter limits + test_with_custom_strategies("sharp_triangle_m2", + sharp_triangle, + join_miter(2), end_flat, distance(4.0), side_strategy, point_strategy, + 166.5374); + test_with_custom_strategies("sharp_triangle_m3", + sharp_triangle, + join_miter(3), end_flat, distance(4.0), side_strategy, point_strategy, + 184.0015); + test_with_custom_strategies("sharp_triangle_m4", + sharp_triangle, + join_miter(4), end_flat, distance(4.0), side_strategy, point_strategy, + 201.4656); + test_with_custom_strategies("sharp_triangle_m5", + sharp_triangle, + join_miter(5), end_flat, distance(4.0), side_strategy, point_strategy, + 218.9296); + test_with_custom_strategies("sharp_triangle_m25", + sharp_triangle, + join_miter(25), end_flat, distance(4.0), side_strategy, point_strategy, + 286.4892); } }