Rename Path._getWindingNumber to _getWinding (to reflect the naming of the existing Path#_getWinding).

This commit is contained in:
Jürg Lehni 2014-02-19 15:46:28 +01:00
parent 093aae0836
commit 19d84a8a8d
2 changed files with 7 additions and 8 deletions

View file

@ -101,7 +101,7 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
random = Math.random, random = Math.random,
abs = Math.abs, abs = Math.abs,
tolerance = /*#=*/ Numerical.TOLERANCE, tolerance = /*#=*/ Numerical.TOLERANCE,
getWindingNumber = PathItem._getWindingNumber; getWinding = PathItem._getWinding;
// Split curves at intersections on both paths. // Split curves at intersections on both paths.
intersections = singlePathOp ? path1.getSelfIntersections(true) intersections = singlePathOp ? path1.getSelfIntersections(true)
: path1.getIntersections(path2, true); : path1.getIntersections(path2, true);
@ -162,8 +162,7 @@ PathItem.inject(new function() { // FIXME: Is new necessary?
point = crv.getPointAt(length); point = crv.getPointAt(length);
v = crv.getValues(); v = crv.getValues();
horizontal = (Curve.isLinear(v) && abs(v[1] - v[7]) < tolerance); horizontal = (Curve.isLinear(v) && abs(v[1] - v[7]) < tolerance);
// PathItem._getWindingNumber windMedian = getWinding(point, monoCurves, horizontal);
windMedian = getWindingNumber(point, monoCurves, horizontal);
// While subtracting, we need to omit this curve if this // While subtracting, we need to omit this curve if this
// curve is contributing to the second operand and is outside // curve is contributing to the second operand and is outside
// the first operand. // the first operand.

View file

@ -270,8 +270,8 @@ var PathItem = Item.extend(/** @lends PathItem# */{
* @return {Number} Winding number. * @return {Number} Winding number.
*/ */
_getWinding: function(point, horizontal) { _getWinding: function(point, horizontal) {
var curves = this._getMonotoneCurves(); return PathItem._getWinding(point, this._getMonotoneCurves(),
return PathItem._getWindingNumber(point, curves, horizontal); horizontal);
}, },
_contains: function(point) { _contains: function(point) {
@ -359,7 +359,7 @@ var PathItem = Item.extend(/** @lends PathItem# */{
* Private static method that returns the winding contribution of the * Private static method that returns the winding contribution of the
* given point with respect to a given set of monotone curves. * given point with respect to a given set of monotone curves.
*/ */
_getWindingNumber: function(point, curves, horizontal) { _getWinding: function _getWinding(point, curves, horizontal) {
function getTangent(v, t) { function getTangent(v, t) {
var sign = t === 0 ? 2 : t === 1 ? -2 : 0, var sign = t === 0 ? 2 : t === 1 ? -2 : 0,
tan; tan;
@ -412,10 +412,10 @@ var PathItem = Item.extend(/** @lends PathItem# */{
yTop = (yTop + y) / 2; yTop = (yTop + y) / 2;
yBot = (yBot + y) / 2; yBot = (yBot + y) / 2;
windLeft = yTop > -Infinity windLeft = yTop > -Infinity
? PathItem._getWindingNumber(new Point(x, yTop), curves) ? _getWinding(new Point(x, yTop), curves)
: 0; : 0;
windRight = yBot < Infinity windRight = yBot < Infinity
? PathItem._getWindingNumber(new Point(x, yBot), curves) ? _getWinding(new Point(x, yBot), curves)
: 0; : 0;
return Math.max(windLeft, windRight); return Math.max(windLeft, windRight);
} }