From 19c1e285add6a8ca7bd2cbac3f6687609cdc8da2 Mon Sep 17 00:00:00 2001 From: Francisco Dans Date: Wed, 26 Aug 2015 13:03:18 +0200 Subject: [PATCH] adds spline converter --- lib/torque/renderer/iso.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/torque/renderer/iso.js b/lib/torque/renderer/iso.js index d4aaa70..4786893 100644 --- a/lib/torque/renderer/iso.js +++ b/lib/torque/renderer/iso.js @@ -265,6 +265,16 @@ torque.extend(IsoRenderer.prototype, torque.Event, { return gctx.getImageData(0, 0, 1, 256).data; }, + cardinalSpline: function(line){ + var plainArray = []; + for (var p = 0; p < line.length; p++){ + var interpolation = line[p].coord.interpolation || {x: 0.5, y: 0.5}; + plainArray.push(20 + 20*line[p].coord.x + 20 * interpolation.x); + plainArray.push(20 + 20*line[p].coord.y + 20 * interpolation.y); + } + return cSpline(plainArray, 0.5, 25, true); + } + /* CARDINAL SPLINE by Steffen Bär