mirror of
https://github.com/boostorg/geometry.git
synced 2025-05-11 21:44:04 +00:00
[algorithm] [test] Assertion for possible division with zero in line_interpolate
This commit is contained in:
parent
f83cb027b5
commit
d0331aa3eb
@ -108,10 +108,11 @@ struct range
|
||||
Distance dist = strategy.get_distance_pp_strategy().apply(*prev, *it);
|
||||
current_distance = prev_distance + dist;
|
||||
|
||||
while (current_distance >= repeated_distance )
|
||||
while (current_distance >= repeated_distance)
|
||||
{
|
||||
point_t p;
|
||||
Distance diff_distance = current_distance - prev_distance;
|
||||
BOOST_ASSERT(diff_distance != Distance(0));
|
||||
strategy.apply(start_p, *it,
|
||||
(repeated_distance - prev_distance)/diff_distance,
|
||||
p,
|
||||
|
@ -137,6 +137,7 @@ std::string const l1 = "LINESTRING(1 1, 2 1, 2 2, 1 2, 1 3)";
|
||||
std::string const l2 = "LINESTRING(0 2, 5 2, 5 1, 20 1)";
|
||||
std::string const l00 = "LINESTRING()";
|
||||
std::string const l01 = "LINESTRING(1 1)";
|
||||
std::string const l02 = "LINESTRING(1 1, 1 1)";
|
||||
|
||||
void test_car_edge_cases()
|
||||
{
|
||||
@ -156,6 +157,10 @@ void test_car_edge_cases()
|
||||
test_distance<LS,P>(l01, 1, "POINT(1 1)");
|
||||
test_distance<LS,MP>(l01, 1, "MULTIPOINT((1 1))");
|
||||
|
||||
//linestring with two same points
|
||||
test_distance<LS,P>(l02, 1, "POINT(1 1)");
|
||||
test_distance<LS,MP>(l02, 1, "MULTIPOINT((1 1))");
|
||||
|
||||
//empty linestring
|
||||
try
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user