mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Use < instead of <= when comparing against TOLERANCE
This commit is contained in:
parent
26cdbb6805
commit
c1485e7068
2 changed files with 6 additions and 6 deletions
|
@ -1049,7 +1049,7 @@ new function() { // Scope for methods that require numerical integration
|
||||||
// Get length of total range
|
// Get length of total range
|
||||||
rangeLength = Numerical.integrate(ds, a, b,
|
rangeLength = Numerical.integrate(ds, a, b,
|
||||||
getIterations(a, b));
|
getIterations(a, b));
|
||||||
if (abs(offset - rangeLength) <= tolerance) {
|
if (abs(offset - rangeLength) < tolerance) {
|
||||||
// Matched the end:
|
// Matched the end:
|
||||||
return forward ? b : a;
|
return forward ? b : a;
|
||||||
} else if (abs(offset) > rangeLength) {
|
} else if (abs(offset) > rangeLength) {
|
||||||
|
@ -1115,7 +1115,7 @@ new function() { // Scope for methods that require numerical integration
|
||||||
dp2 = getSignedDistance(q0x, q0y, q3x, q3y, v1[4], v1[5]),
|
dp2 = getSignedDistance(q0x, q0y, q3x, q3y, v1[4], v1[5]),
|
||||||
dp3 = getSignedDistance(q0x, q0y, q3x, q3y, v1[6], v1[7]),
|
dp3 = getSignedDistance(q0x, q0y, q3x, q3y, v1[6], v1[7]),
|
||||||
tMinNew, tMaxNew, tDiff;
|
tMinNew, tMaxNew, tDiff;
|
||||||
if (q0x === q3x && uMax - uMin <= tolerance && recursion > 3) {
|
if (q0x === q3x && uMax - uMin < tolerance && recursion > 3) {
|
||||||
// The fatline of Q has converged to a point, the clipping is not
|
// The fatline of Q has converged to a point, the clipping is not
|
||||||
// reliable. Return the value we have even though we will miss the
|
// reliable. Return the value we have even though we will miss the
|
||||||
// precision.
|
// precision.
|
||||||
|
|
|
@ -138,15 +138,15 @@ PathItem.inject(new function() {
|
||||||
if (length <= curveLength) {
|
if (length <= curveLength) {
|
||||||
// If the selected location on the curve falls onto its
|
// If the selected location on the curve falls onto its
|
||||||
// beginning or end, use the curve's center instead.
|
// beginning or end, use the curve's center instead.
|
||||||
if (length <= tolerance
|
if (length < tolerance
|
||||||
|| curveLength - length <= tolerance)
|
|| curveLength - length < tolerance)
|
||||||
length = curveLength / 2;
|
length = curveLength / 2;
|
||||||
var curve = node.segment.getCurve(),
|
var curve = node.segment.getCurve(),
|
||||||
pt = curve.getPointAt(length),
|
pt = curve.getPointAt(length),
|
||||||
// Determine if the curve is a horizontal linear
|
// Determine if the curve is a horizontal linear
|
||||||
// curve by checking the slope of it's tangent.
|
// curve by checking the slope of it's tangent.
|
||||||
hor = curve.isLinear() && Math.abs(curve
|
hor = curve.isLinear() && Math.abs(curve
|
||||||
.getTangentAt(0.5, true).y) <= tolerance,
|
.getTangentAt(0.5, true).y) < tolerance,
|
||||||
path = curve._path;
|
path = curve._path;
|
||||||
if (path._parent instanceof CompoundPath)
|
if (path._parent instanceof CompoundPath)
|
||||||
path = path._parent;
|
path = path._parent;
|
||||||
|
@ -320,7 +320,7 @@ PathItem.inject(new function() {
|
||||||
// Detect and exclude intercepts at 'end' of loops:
|
// Detect and exclude intercepts at 'end' of loops:
|
||||||
&& (i === l - 1 || curve.next !== curves[i + 1])
|
&& (i === l - 1 || curve.next !== curves[i + 1])
|
||||||
&& abs(Curve.evaluate(curve.next.values, 0, 0).x -x)
|
&& abs(Curve.evaluate(curve.next.values, 0, 0).x -x)
|
||||||
<= tolerance
|
< tolerance
|
||||||
// Detect 2nd case of a consecutive intercept, but make
|
// Detect 2nd case of a consecutive intercept, but make
|
||||||
// sure we're still on the same loop
|
// sure we're still on the same loop
|
||||||
|| i > 0 && curve.previous === curves[i - 1]
|
|| i > 0 && curve.previous === curves[i - 1]
|
||||||
|
|
Loading…
Reference in a new issue