Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f8181c9

Browse files
committed
FIX: when iterating through segments skip 0 length segments
One method to fix #15842 In this case we check in `path_intersect_path` that as we iterate through the segments, if we hit a 0 length segment we grab the next vertex before checking if the segments from the two paths intersect.
1 parent a06d8e9 commit f8181c9

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/_path.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,18 @@ bool path_intersects_path(PathIterator1 &p1, PathIterator2 &p2)
887887

888888
c1.vertex(&x11, &y11);
889889
while (c1.vertex(&x12, &y12) != agg::path_cmd_stop) {
890+
// if the segment in path 1 is 0 length, skip to next vertex
891+
if ((x11 == x12) && (y11 == y12)) {
892+
continue;
893+
}
890894
c2.rewind(0);
891895
c2.vertex(&x21, &y21);
896+
892897
while (c2.vertex(&x22, &y22) != agg::path_cmd_stop) {
898+
// if the segment in path 2 is 0 length, skip to next vertex
899+
if ((x21 == x22) && (y21 == y22)) {
900+
continue;
901+
}
893902
if (segments_intersect(x11, y11, x12, y12, x21, y21, x22, y22)) {
894903
return true;
895904
}

0 commit comments

Comments
 (0)