mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-03 19:45:44 -05:00
Sample winding at t = 0.5 before trying 0.25 at 0.75
This partly reverts commit 50c910b03a
.
This commit is contained in:
parent
2145efb29b
commit
acd6b143db
1 changed files with 7 additions and 6 deletions
|
@ -644,15 +644,16 @@ PathItem.inject(new function() {
|
||||||
totalLength += length;
|
totalLength += length;
|
||||||
segment = segment.getNext();
|
segment = segment.getNext();
|
||||||
} while (segment && !segment._intersection && segment !== start);
|
} while (segment && !segment._intersection && segment !== start);
|
||||||
// Sample winding at up to three points in the chain, until a winding
|
// Determine winding at three points in the chain. If a winding with
|
||||||
// with sufficient quality is found. The winding with the best quality
|
// sufficient quality is found, use it. Otherwise use the winding with
|
||||||
// is used otherwise.
|
// the best quality.
|
||||||
var windingZero = { winding: 0, quality: 0 },
|
var offsets = [0.5, 0.25, 0.75],
|
||||||
|
windingZero = { winding: 0, quality: 0 },
|
||||||
winding = windingZero,
|
winding = windingZero,
|
||||||
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||||
tMax = 1 - tMin;
|
tMax = 1 - tMin;
|
||||||
for (var i = 0; i < 3 && winding.quality < 0.5; i++) {
|
for (var i = 0; i < offsets.length && winding.quality < 0.5; i++) {
|
||||||
var length = totalLength * (i + 1) / 4;
|
var length = totalLength * offsets[i];
|
||||||
for (var j = 0, l = chain.length; j < l; j++) {
|
for (var j = 0, l = chain.length; j < l; j++) {
|
||||||
var entry = chain[j],
|
var entry = chain[j],
|
||||||
curveLength = entry.length;
|
curveLength = entry.length;
|
||||||
|
|
Loading…
Reference in a new issue