adds spline converter

This commit is contained in:
Francisco Dans 2015-08-26 13:03:18 +02:00
parent 42df5d143f
commit 19c1e285ad

View File

@ -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