mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-19 14:10:14 -05:00
Introduce separate WINDING_EPSILON and improve GEOMETRIC_EPSILON.
New values are based on a lot of testing.
This commit is contained in:
parent
eb62530958
commit
5d6b761d3a
2 changed files with 8 additions and 6 deletions
|
@ -306,7 +306,7 @@ PathItem.inject(new function() {
|
|||
* with respect to a given set of monotone curves.
|
||||
*/
|
||||
function getWinding(point, curves, horizontal, testContains) {
|
||||
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
|
||||
var epsilon = /*#=*/Numerical.WINDING_EPSILON,
|
||||
tMin = /*#=*/Numerical.CURVETIME_EPSILON,
|
||||
tMax = 1 - tMin,
|
||||
px = point.x,
|
||||
|
|
|
@ -103,14 +103,16 @@ var Numerical = new function() {
|
|||
/**
|
||||
* The epsilon to be used when performing "geometric" checks, such as
|
||||
* point distances and examining cross products to check for
|
||||
* collinearity. This value is somewhat arbitrary and was chosen by
|
||||
* trial and error.
|
||||
* collinearity.
|
||||
*/
|
||||
GEOMETRIC_EPSILON: 1e-7,
|
||||
GEOMETRIC_EPSILON: 5e-7, // NOTE: 1e-7 doesn't work in some edge-cases!
|
||||
/**
|
||||
* The epsilon to be used when performing winding contribution checks.
|
||||
*/
|
||||
WINDING_EPSILON: 2e-7, // NOTE: 1e-7 doesn't work in some edge-cases!
|
||||
/**
|
||||
* The epsilon to be used when performing "trigonometric" checks, such
|
||||
* as examining cross products to check for collinearity. This value is
|
||||
* somewhat arbitrary and was chosen by trial and error.
|
||||
* as examining cross products to check for collinearity.
|
||||
*/
|
||||
TRIGONOMETRIC_EPSILON: 1e-8,
|
||||
// Kappa, see: http://www.whizkidtech.redprince.net/bezier/circle/kappa/
|
||||
|
|
Loading…
Reference in a new issue