Handle parameter matching of beginning and ends of curves separately.

This commit is contained in:
Jürg Lehni 2012-09-30 14:06:31 -07:00
parent 93ba19f7e2
commit 9e61995282

View file

@ -487,6 +487,14 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{
},
getParameter: function(v, x, y) {
// Handle beginnings and end seperately, as they are not detected
// sometimes.
if (Math.abs(v[0] - x) < Numerical.TOLERANCE
&& Math.abs(v[1] - y) < Numerical.TOLERANCE)
return 0;
if (Math.abs(v[6] - x) < Numerical.TOLERANCE
&& Math.abs(v[7] - y) < Numerical.TOLERANCE)
return 1;
var txs = [],
tys = [],
sx = Curve.solveCubic(v, 0, x, txs),