From 73364ee40667499f8f3ee047f96a1ed0e1cbe60a Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 23 Mar 2025 00:57:25 +0100 Subject: [PATCH 1/2] Solving issue #2002 by allowing variable widths on the path segments due to 45 degree segment snapping. --- src/db/db/dbPath.cc | 9 +-------- src/db/unit_tests/dbPathTests.cc | 12 ++++++++++++ 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/db/db/dbPath.cc b/src/db/db/dbPath.cc index 59bcdb451..6136a0ee1 100644 --- a/src/db/db/dbPath.cc +++ b/src/db/db/dbPath.cc @@ -372,14 +372,7 @@ void path::create_shifted_points (C start, C end, C width, bool forward, Iter double l1 = db::vprod (nnd - nd, eed) / dv; double l2 = db::vprod (nd - nnd, ed) / dv; - if ((l1 < -db::epsilon) != (l2 < -db::epsilon)) { - - // No well-formed intersection (reflecting edge) -> - // create a direct connection - *pts++ = *pp + vector (nd); - *pts++ = *pp + vector (nnd); - - } else if (l1 < l1min - db::epsilon || l2 < l2min - db::epsilon) { + if (l1 < l1min - db::epsilon || l2 < l2min - db::epsilon) { // Segments are too short - the won't intersect: In this case we create a loop of three // points which define the area in self-overlapping way but confined to the path within diff --git a/src/db/unit_tests/dbPathTests.cc b/src/db/unit_tests/dbPathTests.cc index 10a8be0f1..4bb44cb5b 100644 --- a/src/db/unit_tests/dbPathTests.cc +++ b/src/db/unit_tests/dbPathTests.cc @@ -362,3 +362,15 @@ TEST(11) EXPECT_EQ (to_string (pts), "(-100,10;1010,10;1010,-10;0,-10;0,10;1010,10;1010,-10;-100,-10)"); } +// issue #2002 +TEST(12) +{ + db::Path path; + db::Path::pointlist_type pts; + + tl::Extractor ("(143,381;262,260;381,141) w=400 bx=0 ex=0 r=false").read (path); + + path.hull (pts, 4); + EXPECT_EQ (to_string (pts), "(286,521;454,350;522,282;240,0;70,170;0,241)"); +} + From 986474d4653174a6f3246055fffcb8e0b0614576 Mon Sep 17 00:00:00 2001 From: Matthias Koefferlein Date: Sun, 23 Mar 2025 08:57:06 +0100 Subject: [PATCH 2/2] Added one more testcase --- src/db/unit_tests/dbPathTests.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/db/unit_tests/dbPathTests.cc b/src/db/unit_tests/dbPathTests.cc index 4bb44cb5b..deb3fe22e 100644 --- a/src/db/unit_tests/dbPathTests.cc +++ b/src/db/unit_tests/dbPathTests.cc @@ -372,5 +372,10 @@ TEST(12) path.hull (pts, 4); EXPECT_EQ (to_string (pts), "(286,521;454,350;522,282;240,0;70,170;0,241)"); + + tl::Extractor ("(143,381;262,260;381,141) w=1000 bx=0 ex=0 r=false").read (path); + + path.hull (pts, 4); + EXPECT_EQ (to_string (pts), "(286,521;454,350;522,282;240,0;70,170;0,241;499,732;564,666;735,495;27,-213;-40,-146;-213,30)"); }