Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit df6316c

Browse filesBrowse files
committed
FIX: 0 length segment intersect
One method to fix #15842 In this case we check that if either segment is 0 length, it intersects with no other segments, not all other segments.
1 parent ffa84e0 commit df6316c
Copy full SHA for df6316c

File tree

Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+7
-0
lines changed

‎src/_path.h

Copy file name to clipboardExpand all lines: src/_path.h
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -834,6 +834,13 @@ inline bool segments_intersect(const double &x1,
834834
// it looks the atol value matters here bacause of round-off errors
835835
const double rtol = 1e-10;
836836
const double atol = 1e-13;
837+
838+
// if either segment is 0 length, they do not intersect
839+
840+
if ((x1 == x2 && y1 == y2) || (x3 == x3 && y3 == y4)) {
841+
return false;
842+
}
843+
837844
// determinant
838845
double den = ((y4 - y3) * (x2 - x1)) - ((x4 - x3) * (y2 - y1));
839846

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.