mirror of
https://github.com/boostorg/geometry.git
synced 2026-01-27 19:02:12 +00:00
Harmonized offset with buffer, using range_buffer, and making hooklets vary on parameter.
This repairs offset (broken few days) [SVN r76767]
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
|
||||
template <typename GeometryOut, typename Geometry>
|
||||
void test_offset(bool check, std::string const& caseid, Geometry const& geometry,
|
||||
void test_offset(std::string const& caseid, Geometry const& geometry,
|
||||
double distance,
|
||||
double expected_length, double percentage)
|
||||
{
|
||||
@@ -45,7 +45,8 @@ void test_offset(bool check, std::string const& caseid, Geometry const& geometry
|
||||
typedef bg::strategy::buffer::join_round
|
||||
<
|
||||
point_type,
|
||||
point_type
|
||||
point_type,
|
||||
false
|
||||
> join_strategy;
|
||||
|
||||
GeometryOut moved_by_offset;
|
||||
@@ -66,11 +67,7 @@ void test_offset(bool check, std::string const& caseid, Geometry const& geometry
|
||||
|
||||
|
||||
//BOOST_CHECK_EQUAL(holes, expected_hole_count);
|
||||
if (check)
|
||||
{
|
||||
BOOST_CHECK_CLOSE(length, expected_length, percentage);
|
||||
}
|
||||
|
||||
BOOST_CHECK_CLOSE(length, expected_length, percentage);
|
||||
|
||||
#if defined(TEST_WITH_SVG)
|
||||
{
|
||||
@@ -97,14 +94,14 @@ void test_offset(bool check, std::string const& caseid, Geometry const& geometry
|
||||
|
||||
|
||||
template <typename Geometry>
|
||||
void test_one(bool check, std::string const& caseid, std::string const& wkt, double distance,
|
||||
void test_one(std::string const& caseid, std::string const& wkt, double distance,
|
||||
double expected_length_plus, double expected_length_minus, double percentage = 0.001)
|
||||
{
|
||||
Geometry geometry;
|
||||
bg::read_wkt(wkt, geometry);
|
||||
|
||||
test_offset<Geometry>(check, caseid + "_a", geometry, distance, expected_length_plus, percentage);
|
||||
test_offset<Geometry>(check, caseid + "_b", geometry, -distance, expected_length_minus, percentage);
|
||||
test_offset<Geometry>(caseid + "_a", geometry, distance, expected_length_plus, percentage);
|
||||
test_offset<Geometry>(caseid + "_b", geometry, -distance, expected_length_minus, percentage);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,12 +120,12 @@ void test_all()
|
||||
static std::string const curve = "LINESTRING(2 7,3 5,5 4,7 5,8 7)";
|
||||
static std::string const reallife1 = "LINESTRING(76396.40464822574 410095.6795147947,76397.85016212701 410095.211865792,76401.30666443033 410095.0466387949,76405.05892643372 410096.1007777959,76409.45103273794 410098.257640797,76412.96309264141 410101.6522238015)";
|
||||
|
||||
test_one<linestring>(true, "ls_simplex", simplex, 0.5, std::sqrt(2.0), std::sqrt(2.0));
|
||||
test_one<linestring>(false, "one_bend", one_bend, 0.5, 10.17328, 8.8681);
|
||||
test_one<linestring>(false, "two_bends", two_bends, 0.5, 13.2898, 12.92811);
|
||||
test_one<linestring>(false, "overlapping", overlapping, 0.5, 27.1466, 22.0596);
|
||||
test_one<linestring>(false, "curve", curve, 0.5, 7.7776, 10.0507);
|
||||
test_one<linestring>(false, "reallife1", reallife1, 16.5, 5.4654, 36.4943);
|
||||
test_one<linestring>("ls_simplex", simplex, 0.5, std::sqrt(2.0), std::sqrt(2.0));
|
||||
test_one<linestring>("one_bend", one_bend, 0.5, 10.17328, 8.8681);
|
||||
test_one<linestring>("two_bends", two_bends, 0.5, 13.2898, 12.92811);
|
||||
test_one<linestring>("overlapping", overlapping, 0.5, 27.1466, 22.0596);
|
||||
test_one<linestring>("curve", curve, 0.5, 7.7776, 10.0507);
|
||||
test_one<linestring>("reallife1", reallife1, 16.5, 5.4654, 36.4943);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user