From 5ff990a84a9d6892423d6b167f954690ec764163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=BCrg=20Lehni?= Date: Mon, 17 Jun 2013 08:10:57 -0700 Subject: [PATCH] Fix global variable leakage, and join sequential variable definitions. --- src/path/Curve.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/path/Curve.js b/src/path/Curve.js index f54afb65..7747f2cc 100644 --- a/src/path/Curve.js +++ b/src/path/Curve.js @@ -806,14 +806,14 @@ statics: { * @return {Number} Curvatue of the curve at specified offset */ getCurvatureAt: function(offset, isParameter) { - values = this.getValues(); - // First derivative at offset/parameter - var dt = Curve.evaluate(values, offset, isParameter, 1); - // Second derivative at offset/parameter - var d2t = Curve.evaluate(values, offset, isParameter, 3); - var dx = dt.x, dy = dt.y, d2x = d2t.x, d2y = d2t.y; - var isEnd = offset === 0 || ( isParameter )? offset === 1 : - offset === this.getLength(); + var values = this.getValues(), + // First derivative at offset/parameter + dt = Curve.evaluate(values, offset, isParameter, 1), + // Second derivative at offset/parameter + d2t = Curve.evaluate(values, offset, isParameter, 3), + dx = dt.x, dy = dt.y, d2x = d2t.x, d2y = d2t.y, + isEnd = offset === 0 || ( isParameter )? offset === 1 : + offset === this.getLength(); //Calculate Curvature // if at an end point, k = (2/3) * h / a^2 // else, k = |dx * d2y - dy * d2x| / (( dx^2 + dy^2 )^(3/2))