diff --git a/path_intersection_test.go b/path_intersection_test.go index 37d17fe4..54611b33 100644 --- a/path_intersection_test.go +++ b/path_intersection_test.go @@ -135,16 +135,7 @@ func TestIntersectionLineLine(t *testing.T) { line2.Scan() zs := intersectionLineLine(nil, line1.Start(), line1.End(), line2.Start(), line2.End()) - for i := range tt.zs { - if i < len(zs) { - test.T(t, zs[i], tt.zs[i]) - } else { - test.Fail(t, "expected", test.Green, tt.zs[i], test.Reset) - } - } - for j := len(tt.zs); j < len(zs); j++ { - test.Fail(t, "unexpected", test.Red, zs[j], test.Reset) - } + test.T(t, zs, tt.zs) }) } } diff --git a/path_intersection_util.go b/path_intersection_util.go index b9345387..bfdfd8d2 100644 --- a/path_intersection_util.go +++ b/path_intersection_util.go @@ -1069,11 +1069,11 @@ func intersectionLineLine(zs Intersections, a0, a1, b0, b1 Point) Intersections } return zs } else if a1.Equals(b0) { - // handle common case to avoid numerical issues + // handle common cases with endpoints to avoid numerical issues zs = zs.add(a1, 1.0, 0.0, angle0, angle1, true) return zs } else if a0.Equals(b1) { - // handle common case to avoid numerical issues + // handle common cases with endpoints to avoid numerical issues zs = zs.add(a0, 0.0, 1.0, angle0, angle1, true) return zs }