mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Improve reliability of Curve.getIntersection()
Reduce epsilon when checking against curve end points from GEOMETRIC_EPSILON to EPSILON. Coses #1174
This commit is contained in:
parent
3eafd5256a
commit
b37b8cc495
2 changed files with 21 additions and 1 deletions
|
@ -1908,7 +1908,7 @@ new function() { // Scope for intersection using bezier fat-line clipping
|
|||
// a little optimization, we can scale the handles with 0.75
|
||||
// before calculating the control bounds and still be sure that
|
||||
// the curve is fully contained.
|
||||
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||
var epsilon = /*#=*/Numerical.EPSILON,
|
||||
c1p1x = v1[0], c1p1y = v1[1],
|
||||
c1p2x = v1[6], c1p2y = v1[7],
|
||||
c2p1x = v2[0], c2p1y = v2[1],
|
||||
|
|
|
@ -172,3 +172,23 @@ test('#1088', function() {
|
|||
{ point: { x: 309.99726, y: 309.5004975367957 }, index: 0, time: 0.17182, crossing: true }
|
||||
]);
|
||||
});
|
||||
|
||||
test('#1174', function() {
|
||||
var path1 = new paper.Path({
|
||||
segments: [
|
||||
[20, 60],
|
||||
[20, 100],
|
||||
[150, 100]
|
||||
]
|
||||
});
|
||||
var path2 = new paper.Path({
|
||||
segments: [
|
||||
[20, 140],
|
||||
[20, 100.00000001],
|
||||
[150, 98]
|
||||
]
|
||||
});
|
||||
testIntersection(path1.getIntersections(path2), [
|
||||
{ point: { x: 20, y: 100 }, index: 1, time: 0.00004, crossing: true }
|
||||
]);
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue