mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-28 22:08:54 -04:00
Switch to using GEOMETRIC_EPSILON in getWinding() code.
This commit is contained in:
parent
ef45a5f62c
commit
8047f90ccf
1 changed files with 6 additions and 6 deletions
|
@ -306,8 +306,8 @@ PathItem.inject(new function() {
|
||||||
* with respect to a given set of monotone curves.
|
* with respect to a given set of monotone curves.
|
||||||
*/
|
*/
|
||||||
function getWinding(point, curves, horizontal, testContains) {
|
function getWinding(point, curves, horizontal, testContains) {
|
||||||
var tolerance = /*#=*/Numerical.TOLERANCE,
|
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||||
tMin = tolerance,
|
tMin = /*#=*/Numerical.TOLERANCE,
|
||||||
tMax = 1 - tMin,
|
tMax = 1 - tMin,
|
||||||
px = point.x,
|
px = point.x,
|
||||||
py = point.y,
|
py = point.y,
|
||||||
|
@ -321,8 +321,8 @@ PathItem.inject(new function() {
|
||||||
if (horizontal) {
|
if (horizontal) {
|
||||||
var yTop = -Infinity,
|
var yTop = -Infinity,
|
||||||
yBottom = Infinity,
|
yBottom = Infinity,
|
||||||
yBefore = py - tolerance,
|
yBefore = py - epsilon,
|
||||||
yAfter = py + tolerance;
|
yAfter = py + epsilon;
|
||||||
// Find the closest top and bottom intercepts for the same vertical
|
// Find the closest top and bottom intercepts for the same vertical
|
||||||
// line.
|
// line.
|
||||||
for (var i = 0, l = curves.length; i < l; i++) {
|
for (var i = 0, l = curves.length; i < l; i++) {
|
||||||
|
@ -348,8 +348,8 @@ PathItem.inject(new function() {
|
||||||
if (yBottom < Infinity)
|
if (yBottom < Infinity)
|
||||||
windRight = getWinding(new Point(px, yBottom), curves);
|
windRight = getWinding(new Point(px, yBottom), curves);
|
||||||
} else {
|
} else {
|
||||||
var xBefore = px - tolerance,
|
var xBefore = px - epsilon,
|
||||||
xAfter = px + tolerance;
|
xAfter = px + epsilon;
|
||||||
// Find the winding number for right side of the curve, inclusive of
|
// Find the winding number for right side of the curve, inclusive of
|
||||||
// the curve itself, while tracing along its +-x direction.
|
// the curve itself, while tracing along its +-x direction.
|
||||||
var startCounted = false,
|
var startCounted = false,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue