Rename Curve#getParameter(point) to Curve#getParameterOf(point), to better distinguish from Curve#getParameterAt(length).

This commit is contained in:
Jürg Lehni 2012-12-27 20:09:21 +01:00
parent 00898908d3
commit 3c4978eb04
3 changed files with 14 additions and 13 deletions

View file

@ -273,6 +273,15 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
start !== undefined ? start : offset < 0 ? 1 : 0);
},
/**
* @param {Point} point
* @return {Number}
*/
getParameterOf: function(point) {
point = Point.read(arguments);
return Curve.getParameterOf(this.getValues(), point.x, point.y);
},
/**
* Returns the point on the curve at the specified position.
*
@ -304,15 +313,6 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
return Curve.evaluate(this.getValues(), parameter, 2);
},
/**
* @param {Point} point
* @return {Number}
*/
getParameter: function(point) {
point = Point.read(point);
return Curve.getParameter(this.getValues(), point.x, point.y);
},
getIntersections: function(curve) {
return Curve._addIntersections(this.getValues(), curve.getValues(),
this, []);
@ -493,7 +493,7 @@ statics: {
/*#=*/ Numerical.TOLERANCE);
},
getParameter: function(v, x, y) {
getParameterOf: function(v, x, y) {
// Handle beginnings and end seperately, as they are not detected
// sometimes.
if (Math.abs(v[0] - x) < /*#=*/ Numerical.TOLERANCE

View file

@ -136,8 +136,9 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
* @bean
*/
getParameter: function() {
if (this._parameter == null && this._curve && this._point)
this._parameter = this._curve.getParameterAt(this._point);
if (this._parameter == null && this._curve && this._point) {
this._parameter = this._curve.getParameterOf(this._point);
}
return this._parameter;
},

View file

@ -992,7 +992,7 @@ var Path = this.Path = PathItem.extend(/** @lends Path# */{
var curves = this.getCurves();
for (var i = 0, l = curves.length; i < l; i++) {
var curve = curves[i];
var t = curve.getParameter(point);
var t = curve.getParameterOf(point);
if (t != null)
return new CurveLocation(curve, t);
}