mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 13:34:10 +00:00
[buffer] fix round end cap for asymmetric buffers
This commit is contained in:
parent
e4f2bd4ce0
commit
8aa31d68cc
@ -124,28 +124,29 @@ public :
|
||||
double
|
||||
>::type promoted_type;
|
||||
|
||||
promoted_type const alpha = calculate_angle<promoted_type>(perp_left_point, ultimate_point);
|
||||
|
||||
promoted_type const dist_left = distance.apply(penultimate_point, ultimate_point, buffer_side_left);
|
||||
promoted_type const dist_right = distance.apply(penultimate_point, ultimate_point, buffer_side_right);
|
||||
promoted_type const alpha
|
||||
= calculate_angle<promoted_type>(penultimate_point, ultimate_point)
|
||||
- geometry::math::half_pi<promoted_type>();
|
||||
|
||||
if (geometry::math::equals(dist_left, dist_right))
|
||||
{
|
||||
generate_points(ultimate_point, alpha, dist_left, range_out);
|
||||
}
|
||||
else
|
||||
{
|
||||
promoted_type const two = 2.0;
|
||||
promoted_type dist_half_diff = (dist_left - dist_right) / two;
|
||||
|
||||
if (side == buffer_side_right)
|
||||
{
|
||||
dist_half_diff = -dist_half_diff;
|
||||
}
|
||||
static promoted_type const two = 2.0;
|
||||
promoted_type const dist_average = (dist_left + dist_right) / two;
|
||||
promoted_type const dist_half
|
||||
= (side == buffer_side_right
|
||||
? (dist_right - dist_left)
|
||||
: (dist_left - dist_right)) / two;
|
||||
|
||||
Point shifted_point;
|
||||
set<0>(shifted_point, get<0>(ultimate_point) + dist_half_diff * cos(alpha));
|
||||
set<1>(shifted_point, get<1>(ultimate_point) + dist_half_diff * sin(alpha));
|
||||
generate_points(shifted_point, alpha, (dist_left + dist_right) / two, range_out);
|
||||
set<0>(shifted_point, get<0>(ultimate_point) + dist_half * cos(alpha));
|
||||
set<1>(shifted_point, get<1>(ultimate_point) + dist_half * sin(alpha));
|
||||
generate_points(shifted_point, alpha, dist_average, range_out);
|
||||
}
|
||||
|
||||
if (m_points_per_circle % 2 == 1)
|
||||
|
@ -344,18 +344,20 @@ void test_all()
|
||||
test_one<linestring, polygon>("mysql_25662426a_mostly_right_5", mysql_25662426a, join_round32, end_round32, 102.6952, 0.5, settings, 5.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_mostly_right_10", mysql_25662426a, join_round32, end_round32, 260.1850, 1.0, settings, 10.0);
|
||||
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
// Left
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_05", mysql_25662426a, join_round32, end_round32, 14.2803, 0.5, settings, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_1", mysql_25662426a, join_round32, end_round32, 30.1214, 1.0, settings, 0.0);
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_2", mysql_25662426a, join_round32, end_round32, 999.9, 2.0, settings, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_3", mysql_25662426a, join_round32, end_round32, 999.9, 3.0, settings, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_4", mysql_25662426a, join_round32, end_round32, 999.9, 4.0, settings, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_5", mysql_25662426a, join_round32, end_round32, 999.9, 5.0, settings, 0.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_left_10", mysql_25662426a, join_round32, end_round32, 554.8818, 10.0, settings, 0.0);
|
||||
#endif
|
||||
|
||||
// Right
|
||||
test_one<linestring, polygon>("mysql_25662426a_right_05", mysql_25662426a, join_round32, end_round32, 12.9451, 0.0, settings, 0.5);
|
||||
#if defined(BOOST_GEOMETRY_TEST_FAILURES)
|
||||
test_one<linestring, polygon>("mysql_25662426a_right_1", mysql_25662426a, join_round32, end_round32, 999.9, 0.0, settings, 1.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_right_2", mysql_25662426a, join_round32, end_round32, 999.9, 0.0, settings, 2.0);
|
||||
test_one<linestring, polygon>("mysql_25662426a_right_3", mysql_25662426a, join_round32, end_round32, 999.9, 0.0, settings, 3.0);
|
||||
|
Loading…
x
Reference in New Issue
Block a user