From f28e6ba372afc0cfb8c60f1fa49b023ba85174d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Fri, 24 May 2013 22:03:42 -0700 Subject: [PATCH] Merge handling of flat curves. --- fatline/Intersect.js | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/fatline/Intersect.js b/fatline/Intersect.js index c1edd051..6706df75 100644 --- a/fatline/Intersect.js +++ b/fatline/Intersect.js @@ -153,15 +153,13 @@ function getCurveIntersections(v1, v2, curve1, curve2, locations, // as lines. var flat1 = Curve.isFlatEnough(part1, /*#=*/ Numerical.TOLERANCE), flat2 = Curve.isFlatEnough(part2, /*#=*/ Numerical.TOLERANCE); - if (flat1 && flat2) { - getLineLineIntersection(part1, part2, curve1, curve2, locations); - break; - } if (flat1 || flat2) { - // Use curve line intersection method while specifying which - // curve to be treated as line - getCurveLineIntersections(part1, part2, curve1, curve2, locations, - flat1); + (flat1 && flat2 + ? getLineLineIntersection + // Use curve line intersection method while specifying + // which curve to be treated as line + : getCurveLineIntersections)(part1, part2, + curve1, curve2, locations, flat1); break; } }