diff --git a/lib/torque/renderer/ball.js b/lib/torque/renderer/ball.js index d3ee511..8e7c798 100644 --- a/lib/torque/renderer/ball.js +++ b/lib/torque/renderer/ball.js @@ -175,12 +175,6 @@ BallRenderer.prototype = { var y = (index - 4 * x) / (4 * this.width); return [x,y]; }, - // Clockwise. Again, there definitely is a better way. - getNeighbors: function(index){ - var n = index - this.chWidth; - var s = index + this.chWidth; - return [n, n + 4, index + 4, s + 4, s, s - 4, index - 4, n -4]; - }, isEmpty: function(layer) { for (var i = 0; i 0) return false; @@ -230,37 +224,21 @@ BallRenderer.prototype = { } }, isopleth: function(){ - var iso = this.createArray(); - var contour = this.contourLayer; - var eq = false; - for (var i = 0, len = contour.length; i 20 && alpha < 255){ - var neighbors = this.getNeighbors(i); - var refCol = contour[neighbors[0]+3]; - for (var n = 1, ln = neighbors.length; n0 && (contour[index+3] === 0 || contour[index+3] !== contour[i+3])){ - iso[index + 3] = contour[i+3]; - iso[index] = 153; - iso[index + 1] = 60; - iso[index + 2] = 243; - } - } - } - } - } - else{ - eq = false; + if(typeof this.isoplethLayer === 'undefined') this.isoplethLayer = new Uint8Array(this.size * 4); + for (var i = 0, len = this.contourLayer.length; i 20 && alpha < 255){ + var n = i - this.chWidth, + s = i + this.chWidth, + neighbors = [n, n + 4, i + 4, s + 4, s, s - 4, i - 4, n -4]; + for (var n = 0, ln = neighbors.length; n0 && (this.contourLayer[index+3] === 0 || this.contourLayer[index+3] !== this.contourLayer[i+3])){ + this.isoplethLayer[index + 3] = Math.min(this.contourLayer[i+3],255); + } + } } } - this.isoplethLayer = iso; }, heatmap: function (gradient){