Sample tomography distances to cap number around 360

This commit is contained in:
Ross McFarland 2016-05-17 12:57:02 -07:00
parent 58c3b08134
commit 559dc4599e
1 changed files with 6 additions and 2 deletions

View File

@ -104,7 +104,6 @@ Ember.Handlebars.helper('tomographyGraph', function(tomography, size) {
// if/when Handlebars fixes the underlying issues all of this can be cleaned
// up drastically.
var n = tomography.n;
var max = Math.max.apply(null, tomography.distances);
var insetSize = size / 2 - 8;
var buf = '' +
@ -118,7 +117,12 @@ Ember.Handlebars.helper('tomographyGraph', function(tomography, size) {
' <circle class="border" r="' + insetSize + '"/>' +
' </g>' +
' <g class="lines">';
tomography.distances.forEach(function (distance, i) {
var sampling = 360 / tomography.n;
distances = tomography.distances.filter(function () {
return Math.random() < sampling
});
var n = distances.length;
distances.forEach(function (distance, i) {
buf += ' <line transform="rotate(' + (i * 360 / n) + ')" y2="' + (-insetSize * (distance / max)) + '"></line>';
});
buf += '' +