diff --git a/src/basic/Matrix.js b/src/basic/Matrix.js index 3a6f5a49..b7a4236b 100644 --- a/src/basic/Matrix.js +++ b/src/basic/Matrix.js @@ -494,7 +494,7 @@ var Matrix = this.Matrix = Base.extend(/** @lends Matrix# */{ getRotation: function() { var angle1 = -Math.atan2(this._b, this._d), angle2 = Math.atan2(this._c, this._a); - return Math.abs(angle1 - angle2) < Numerical.EPSILON + return Math.abs(angle1 - angle2) < /*#=*/ Numerical.EPSILON ? angle1 * 180 / Math.PI : undefined; }, diff --git a/src/basic/Point.js b/src/basic/Point.js index 315db5db..f9991279 100644 --- a/src/basic/Point.js +++ b/src/basic/Point.js @@ -687,7 +687,7 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ * @returns {Boolean} {@true it is parallel} */ isColinear: function(point) { - return this.cross(point) < Numerical.TOLERANCE; + return this.cross(point) < /*#=*/ Numerical.TOLERANCE; }, /** @@ -698,7 +698,7 @@ var Point = this.Point = Base.extend(/** @lends Point# */{ * @returns {Boolean} {@true it is orthogonal} */ isOrthogonal: function(point) { - return this.dot(point) < Numerical.TOLERANCE; + return this.dot(point) < /*#=*/ Numerical.TOLERANCE; }, /** diff --git a/src/constants.js b/src/constants.js index 54e9213f..ad9b9517 100644 --- a/src/constants.js +++ b/src/constants.js @@ -16,4 +16,5 @@ /*#*/ include('item/ChangeFlag.js'); /*#*/ include('path/SelectionState.js'); + /*#*/ include('util/Numerical.js'); /*#*/ include('svg/constants.js'); diff --git a/src/path/Curve.js b/src/path/Curve.js index 6f9546ef..2675ab09 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -316,8 +316,8 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{ getCrossings: function(point, roots) { // Implement the crossing number algorithm: // http://en.wikipedia.org/wiki/Point_in_polygon - // Solve the y-axis cubic polynominal for point.y and count all - // solutions to the right of point.x as crossings. + // Solve the y-axis cubic polynomial for point.y and count all solutions + // to the right of point.x as crossings. var vals = this.getValues(), count = Curve.solveCubic(vals, 1, point.y, roots), crossings = 0; @@ -329,9 +329,9 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{ // touching a tip. Passing 1 for Curve.evaluate()'s type means // we're calculating tangents, and then check their y-slope for // a change of direction: - if (t < Numerical.TOLERANCE && Curve.evaluate( + if (t < /*#=*/ Numerical.TOLERANCE && Curve.evaluate( this.getPrevious().getValues(), 1, 1).y - * Curve.evaluate(vals, t, 1).y >= Numerical.TOLERANCE) + * Curve.evaluate(vals, t, 1).y >= /*#=*/ Numerical.TOLERANCE) continue; crossings++; } @@ -657,7 +657,7 @@ new function() { // Scope for methods that require numerical integration } return Numerical.findRoot(f, ds, forward ? a + guess : b - guess, // Initial guess for x - a, b, 16, Numerical.TOLERANCE); + a, b, 16, /*#=*/ Numerical.TOLERANCE); } }; }, new function() { // Scope for nearest point on curve problem diff --git a/src/path/PathFitter.js b/src/path/PathFitter.js index 2b39f05f..b739df1c 100644 --- a/src/path/PathFitter.js +++ b/src/path/PathFitter.js @@ -95,7 +95,7 @@ var PathFitter = Base.extend({ // Use least-squares method to find Bezier control points for region. generateBezier: function(first, last, uPrime, tan1, tan2) { - var epsilon = Numerical.EPSILON, + var epsilon = /*#=*/ Numerical.EPSILON, pt1 = this.points[first], pt2 = this.points[last], // Create the C and X matrices @@ -194,7 +194,7 @@ var PathFitter = Base.extend({ diff = pt.subtract(point), df = pt1.dot(pt1) + diff.dot(pt2); // Compute f(u) / f'(u) - if (Math.abs(df) < Numerical.TOLERANCE) + if (Math.abs(df) < /*#=*/ Numerical.TOLERANCE) return u; // u = u - f(u) / f'(u) return u - diff.dot(pt1) / df; diff --git a/src/path/PathFlattener.js b/src/path/PathFlattener.js index b29cbfef..c444afad 100644 --- a/src/path/PathFlattener.js +++ b/src/path/PathFlattener.js @@ -62,7 +62,7 @@ var PathFlattener = Base.extend({ var x = curve[6] - curve[0], y = curve[7] - curve[1], dist = Math.sqrt(x * x + y * y); - if (dist > Numerical.TOLERANCE) { + if (dist > /*#=*/ Numerical.TOLERANCE) { this.length += dist; this.parts.push({ offset: this.length,