Use same tolerance in Curve.isLinear() as in Curve#isLinear().

This commit is contained in:
Jürg Lehni 2013-10-17 20:19:34 +02:00
parent 2a3ede67bb
commit a07538b205
2 changed files with 4 additions and 2 deletions

View file

@ -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) {

View file

@ -70,7 +70,7 @@ var Numerical = new function() {
* Numerical.EPSILON.
*/
isZero: function(val) {
return abs(val) <= this.EPSILON;
return abs(val) <= Numerical.EPSILON;
},
/**