Add CurveLocation#distance, for Curve#getNearestLocation().

This commit is contained in:
Jürg Lehni 2011-07-06 22:19:01 +02:00
parent 0c0807e3e9
commit c35133fae9

View file

@ -37,10 +37,11 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
* @param {Number} parameter * @param {Number} parameter
* @param {Point} point * @param {Point} point
*/ */
initialize: function(curve, parameter, point) { initialize: function(curve, parameter, point, distance) {
this._curve = curve; this._curve = curve;
this._parameter = parameter; this._parameter = parameter;
this._point = point; this._point = point;
this._distance = distance;
}, },
/** /**
@ -176,6 +177,16 @@ CurveLocation = Base.extend(/** @lends CurveLocation# */{
&& this._curve.getNormal(parameter); && this._curve.getNormal(parameter);
}, },
/**
* The distance from the queried point to the returned location.
*
* @type Number
* @bean
*/
getDistance: function() {
return this._distance;
},
/** /**
* @return {String} A string representation of the curve location. * @return {String} A string representation of the curve location.
*/ */