From a07538b2050f54c3410f1ac2188806049745dcb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Thu, 17 Oct 2013 20:19:34 +0200 Subject: [PATCH] Use same tolerance in Curve.isLinear() as in Curve#isLinear(). --- src/path/Curve.js | 4 +++- src/util/Numerical.js | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index 7285a054..2d1f3fa8 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -598,7 +598,9 @@ statics: { }, isLinear: function(v) { - return v[0] === v[2] && v[1] === v[3] && v[4] === v[6] && v[5] === v[7]; + var isZero = Numerical.isZero; + return isZero(v[0] - v[2]) && isZero(v[1] - v[3]) + && isZero(v[4] - v[6]) && isZero(v[5] - v[7]); }, isFlatEnough: function(v, tolerance) { diff --git a/src/util/Numerical.js b/src/util/Numerical.js index 11e25a36..ca4a295b 100644 --- a/src/util/Numerical.js +++ b/src/util/Numerical.js @@ -70,7 +70,7 @@ var Numerical = new function() { * Numerical.EPSILON. */ isZero: function(val) { - return abs(val) <= this.EPSILON; + return abs(val) <= Numerical.EPSILON; }, /**