Merge branch 'bugfix/issue-2002' into wip

This commit is contained in:
Matthias Koefferlein 2025-03-23 11:10:54 +01:00
commit 16be7bf8c1
2 changed files with 18 additions and 8 deletions

View File

@ -372,14 +372,7 @@ void path<C>::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<C> (nd);
*pts++ = *pp + vector<C> (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

View File

@ -362,3 +362,20 @@ 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)");
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)");
}