mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Use the correct GEOMETRIC_EPSILON when matching beginnings and ends of curve in Curve.getParameterOf()
Relates to #777
This commit is contained in:
parent
8047f90ccf
commit
4f04dae20f
1 changed files with 4 additions and 4 deletions
|
@ -592,11 +592,11 @@ statics: {
|
||||||
getParameterOf: function(v, x, y) {
|
getParameterOf: function(v, x, y) {
|
||||||
// Handle beginnings and end separately, as they are not detected
|
// Handle beginnings and end separately, as they are not detected
|
||||||
// sometimes.
|
// sometimes.
|
||||||
var tolerance = /*#=*/Numerical.TOLERANCE,
|
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||||
abs = Math.abs;
|
abs = Math.abs;
|
||||||
if (abs(v[0] - x) < tolerance && abs(v[1] - y) < tolerance)
|
if (abs(v[0] - x) < epsilon && abs(v[1] - y) < epsilon)
|
||||||
return 0;
|
return 0;
|
||||||
if (abs(v[6] - x) < tolerance && abs(v[7] - y) < tolerance)
|
if (abs(v[6] - x) < epsilon && abs(v[7] - y) < epsilon)
|
||||||
return 1;
|
return 1;
|
||||||
var txs = [],
|
var txs = [],
|
||||||
tys = [],
|
tys = [],
|
||||||
|
@ -619,7 +619,7 @@ statics: {
|
||||||
ty = tx;
|
ty = tx;
|
||||||
}
|
}
|
||||||
// Use average if we're within tolerance
|
// Use average if we're within tolerance
|
||||||
if (abs(tx - ty) < tolerance)
|
if (abs(tx - ty) < /*#=*/Numerical.TOLERANCE)
|
||||||
return (tx + ty) * 0.5;
|
return (tx + ty) * 0.5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue