mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Fix issue with curve tangents in rare edge-cases.
We should fix Curve.evaluate() for these instead.
This commit is contained in:
parent
b89fc84789
commit
2a58828e81
1 changed files with 6 additions and 4 deletions
|
@ -463,16 +463,18 @@ statics: {
|
|||
&& (ixOtherSeg = ixOther._segment)
|
||||
&& ixOtherSeg !== startSeg && firstHandleIn) {
|
||||
c1 = seg.getCurve();
|
||||
// TODO: Support getTangentAt(0) / (1)
|
||||
var offset = 1e-3;
|
||||
if (direction < 1) {
|
||||
t1 = c1.getTangentAt(0, true);
|
||||
t1 = c1.getTangentAt(offset, true);
|
||||
} else {
|
||||
c1 = c1.getPrevious();
|
||||
t1 = c1.getTangentAt(1, true).negate();
|
||||
t1 = c1.getTangentAt(1 - offset, true).negate();
|
||||
}
|
||||
c4 = crvTan[1].c = ixOtherSeg.getCurve();
|
||||
c3 = crvTan[0].c = c4.getPrevious();
|
||||
crvTan[0].t = c3.getTangentAt(1, true).negate();
|
||||
crvTan[1].t = c4.getTangentAt(0, true);
|
||||
crvTan[0].t = c3.getTangentAt(1 - offset, true).negate();
|
||||
crvTan[1].t = c4.getTangentAt(offset, true);
|
||||
// cross product of the entry and exit tangent vectors at
|
||||
// the intersection, will let us select the correct countour
|
||||
// to traverse next.
|
||||
|
|
Loading…
Reference in a new issue