mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -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) {
|
||||
// Handle beginnings and end separately, as they are not detected
|
||||
// sometimes.
|
||||
var tolerance = /*#=*/Numerical.TOLERANCE,
|
||||
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||
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;
|
||||
if (abs(v[6] - x) < tolerance && abs(v[7] - y) < tolerance)
|
||||
if (abs(v[6] - x) < epsilon && abs(v[7] - y) < epsilon)
|
||||
return 1;
|
||||
var txs = [],
|
||||
tys = [],
|
||||
|
@ -619,7 +619,7 @@ statics: {
|
|||
ty = tx;
|
||||
}
|
||||
// Use average if we're within tolerance
|
||||
if (abs(tx - ty) < tolerance)
|
||||
if (abs(tx - ty) < /*#=*/Numerical.TOLERANCE)
|
||||
return (tx + ty) * 0.5;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue