Skip to content

Commit 56d153a

Browse files
committed
Add separate ANGULAR_EPSILON for arcTo()
1 parent a11d396 commit 56d153a

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

src/path/Path.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2575,12 +2575,14 @@ new function() { // PostScript-style drawing commands
25752575
}
25762576
}
25772577
if (extent) {
2578-
var epsilon = /*#=*/Numerical.GEOMETRIC_EPSILON,
2578+
var epsilon = /*#=*/Numerical.ANGULAR_EPSILON,
25792579
ext = abs(extent),
25802580
// Calculate amount of segments required to approximate over
25812581
// `extend` degrees (extend / 90), but prevent ceil() from
25822582
// rounding up small imprecisions by subtracting epsilon.
2583-
count = ext >= 360 ? 4 : Math.ceil((ext - epsilon) / 90),
2583+
count = ext >= 360
2584+
? 4
2585+
: Math.ceil((ext - epsilon) / 90),
25842586
inc = extent / count,
25852587
half = inc * Math.PI / 360,
25862588
z = 4 / 3 * Math.sin(half) / (1 + Math.cos(half)),

src/util/Numerical.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ var Numerical = new function() {
152152
* as examining cross products to check for collinearity.
153153
*/
154154
TRIGONOMETRIC_EPSILON: 1e-8,
155+
/**
156+
* The epsilon to be used when performing angular checks in degrees,
157+
* e.g. in `arcTo()`.
158+
*/
159+
ANGULAR_EPSILON: 1e-5,
155160
/**
156161
* Kappa is the value which which to scale the curve handles when
157162
* drawing a circle with bezier curves.

0 commit comments

Comments
 (0)