diff --git a/examples/Tools/SquareRounded.html b/examples/Tools/SquareRounded.html
index 1b3de8e9..90c94ff9 100644
--- a/examples/Tools/SquareRounded.html
+++ b/examples/Tools/SquareRounded.html
@@ -23,7 +23,7 @@
function checkValues() {
var min = values.radius * 2;
if (values.tolerance < min) values.tolerance = min;
- handle = values.radius * 0.5522847498; // kappa
+ handle = values.radius * Numerical.KAPPA;
}
var path;
diff --git a/src/path/Path.Constructors.js b/src/path/Path.Constructors.js
index 9a195cfe..53517363 100644
--- a/src/path/Path.Constructors.js
+++ b/src/path/Path.Constructors.js
@@ -56,8 +56,7 @@ Path.inject({ statics: new function() {
return path;
}
- // Kappa, see: http://www.whizkidtech.redprince.net/bezier/circle/kappa/
- var kappa = 2 * (Math.sqrt(2) - 1) / 3;
+ var kappa = Numerical.KAPPA;
var ellipseSegments = [
new Segment([0, 0.5], [0, kappa ], [0, -kappa]),
diff --git a/src/svg/SvgExport.js b/src/svg/SvgExport.js
index a42288e9..002c7349 100644
--- a/src/svg/SvgExport.js
+++ b/src/svg/SvgExport.js
@@ -112,13 +112,10 @@ new function() {
seg4._point.subtract(seg3._point));
}
- // Kappa, see: http://www.whizkidtech.redprince.net/bezier/circle/kappa/
- var kappa = 4 * (Math.sqrt(2) - 1) / 3;
-
// Returns true if the segment at the given index is the beginning of
// a orthogonal arc segment. The code is looking at the length of the
// handles and their relation to the distance to the imaginary corner
- // point. If the relation is kappa (see above), then it's an arc.
+ // point. If the relation is kappa, then it's an arc.
function isArc(i) {
var segment = segments[i],
next = segment.getNext(),
@@ -132,9 +129,9 @@ new function() {
corner = new Line(from, handle1).intersect(
new Line(to, handle2));
return corner && Numerical.isZero(handle1.getLength() /
- corner.subtract(from).getLength() - kappa)
+ corner.subtract(from).getLength() - Numerical.KAPPA)
&& Numerical.isZero(handle2.getLength() /
- corner.subtract(to).getLength() - kappa);
+ corner.subtract(to).getLength() - Numerical.KAPPA);
}
}
diff --git a/src/util/Numerical.js b/src/util/Numerical.js
index 8ccf77f0..5c530064 100644
--- a/src/util/Numerical.js
+++ b/src/util/Numerical.js
@@ -10,7 +10,7 @@
* All rights reserved.
*/
-var Numerical = new function() {
+var Numerical = this.Numerical = new function() {
// Lookup tables for abscissas and weights with values for n = 2 .. 16.
// As values are symetric, only store half of them and addapt algorithm
@@ -68,6 +68,8 @@ var Numerical = new function() {
// Precision when comparing against 0
// TODO: Find a good value
EPSILON: 10e-12,
+ // Kappa, see: http://www.whizkidtech.redprince.net/bezier/circle/kappa/
+ KAPPA: 2 * (sqrt(2) - 1) / 3,
/**
* Check if the value is 0, within a tolerance defined by