mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-07 13:22:07 -05:00
Boolean -fix: Interpolate to find the parameter of intersection in linear curve segments
This commit is contained in:
parent
0a22211393
commit
f9b4321a56
1 changed files with 7 additions and 4 deletions
|
@ -1393,13 +1393,16 @@ new function() { // Scope for methods that require numerical integration
|
||||||
var point = Curve.evaluate(vcr, t, 0);
|
var point = Curve.evaluate(vcr, t, 0);
|
||||||
// We do have a point on the infinite line. Check if it falls on
|
// We do have a point on the infinite line. Check if it falls on
|
||||||
// the line *segment*.
|
// the line *segment*.
|
||||||
if (point.x >= 0 && point.x <= rl2x)
|
if (point.x >= 0 && point.x <= rl2x){
|
||||||
|
// Interpolate for the parameter for the intersection on line
|
||||||
|
var tl = point.x / rl2x;
|
||||||
if(flip)
|
if(flip)
|
||||||
addLocation(locations, curve1, undefined, Curve.evaluate(vc, t, 0),
|
addLocation(locations, curve1, tl, Curve.evaluate(vl, tl, 0),
|
||||||
curve2, t, Curve.evaluate(vc, t, 0));
|
curve2, t, Curve.evaluate(vc, t, 0));
|
||||||
else
|
else
|
||||||
addLocation(locations, curve1, t,
|
addLocation(locations, curve1, t, Curve.evaluate(vc, t, 0),
|
||||||
Curve.evaluate(vc, t, 0), curve2);
|
curve2, tl, Curve.evaluate(vl, tl, 0));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue