mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-06 04:42:15 -05:00
Use standard values for tMin / tMax when calling getTangentAt() tracePaths()
This commit is contained in:
parent
6bb6002d1a
commit
46d7717812
1 changed files with 5 additions and 5 deletions
|
@ -344,8 +344,8 @@ PathItem.inject(new function() {
|
||||||
var paths = [],
|
var paths = [],
|
||||||
// Values for getTangentAt() that are almost 0 and 1.
|
// Values for getTangentAt() that are almost 0 and 1.
|
||||||
// TODO: Correctly support getTangentAt(0) / (1)?
|
// TODO: Correctly support getTangentAt(0) / (1)?
|
||||||
ZERO = 1e-3,
|
tMin = /*#=*/Numerical.TOLERANCE,
|
||||||
ONE = 1 - 1e-3;
|
tMax = 1 - tMin;
|
||||||
for (var i = 0, seg, startSeg, l = segments.length; i < l; i++) {
|
for (var i = 0, seg, startSeg, l = segments.length; i < l; i++) {
|
||||||
seg = startSeg = segments[i];
|
seg = startSeg = segments[i];
|
||||||
if (seg._visited || !operator(seg._winding))
|
if (seg._visited || !operator(seg._winding))
|
||||||
|
@ -376,14 +376,14 @@ PathItem.inject(new function() {
|
||||||
var c1 = seg.getCurve();
|
var c1 = seg.getCurve();
|
||||||
if (dir > 0)
|
if (dir > 0)
|
||||||
c1 = c1.getPrevious();
|
c1 = c1.getPrevious();
|
||||||
var t1 = c1.getTangentAt(dir < 1 ? ZERO : ONE, true),
|
var t1 = c1.getTangentAt(dir < 1 ? tMin : tMax, true),
|
||||||
// Get both curves at the intersection (except the
|
// Get both curves at the intersection (except the
|
||||||
// entry curves).
|
// entry curves).
|
||||||
c4 = interSeg.getCurve(),
|
c4 = interSeg.getCurve(),
|
||||||
c3 = c4.getPrevious(),
|
c3 = c4.getPrevious(),
|
||||||
// Calculate their winding values and tangents.
|
// Calculate their winding values and tangents.
|
||||||
t3 = c3.getTangentAt(ONE, true),
|
t3 = c3.getTangentAt(tMax, true),
|
||||||
t4 = c4.getTangentAt(ZERO, true),
|
t4 = c4.getTangentAt(tMin, true),
|
||||||
// Cross product of the entry and exit tangent
|
// Cross product of the entry and exit tangent
|
||||||
// vectors at the intersection, will let us select
|
// vectors at the intersection, will let us select
|
||||||
// the correct contour to traverse next.
|
// the correct contour to traverse next.
|
||||||
|
|
Loading…
Reference in a new issue