From 45c7f9c4fcd3d9fffb9c7f070b28d54d3cd3e9ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Sat, 9 Jul 2011 11:20:03 +0200 Subject: [PATCH] Port back code to prevent tangents and normals of length 0 from Scriptographer. --- src/path/Curve.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/path/Curve.js b/src/path/Curve.js index 03c32e03..1beb164e 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -413,6 +413,13 @@ var Curve = this.Curve = Base.extend(/** @lends Curve# */{ x = t == 0 ? p1x : p2x; y = t == 0 ? p1y : p2y; } else { + // TODO: Find a better solution for this: + // Prevent tangents and normals of length 0: + var tMin = Numerical.TOLERANCE; + if (t < tMin && c1x == p1x && c1y == p1y) + t = tMin; + else if (t > 1 - tMin && c2x == p2x && c2y == p2y) + t = 1 - tMin; // Calculate the polynomial coefficients. var cx = 3 * (c1x - p1x), bx = 3 * (c2x - c1x) - cx,