lore-engine
Advanced tools
Comparing version 1.0.2 to 1.0.3
{ | ||
"name": "lore-engine", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "A WebGL based 3D data visualization engine.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/lore.js", |
@@ -82,3 +82,2 @@ | ||
viewMatrix.invert(); | ||
console.log(viewMatrix.toString()); | ||
this.viewMatrix = viewMatrix; | ||
@@ -85,0 +84,0 @@ this.isViewMatrixStale = true; |
@@ -117,5 +117,6 @@ /** | ||
this.setClearColor(this.opts.clearColor); | ||
// Blending | ||
if (!this.webgl2) { | ||
this.setClearColor(this.opts.clearColor); | ||
g.clearDepth(this.opts.clearDepth); | ||
@@ -122,0 +123,0 @@ |
@@ -6,3 +6,3 @@ /** | ||
let Lore = { | ||
Version: '1.0.2' | ||
Version: '1.0.3' | ||
}; | ||
@@ -9,0 +9,0 @@ |
@@ -101,16 +101,17 @@ /** A helper class containing statistics methods. */ | ||
* @param {Number[]} arr An array. | ||
* @param {Number} q1 The q1 percentage. | ||
* @param {Number} q3 The q3 percentage. | ||
* @param {Number} k The IQR scaling factor. | ||
* @returns {Number[]} The normalized / scaled array. | ||
*/ | ||
static normalizeNoOutliers(arr) { | ||
static normalizeNoOutliers(arr, q1 = 0.25, q3 = 0.75, k = 1.5) { | ||
let newArr = arr.slice(); | ||
let max = Number.NEGATIVE_INFINITY; | ||
let min = Number.POSITIVE_INFINITY; | ||
newArr.sort((a, b) => a - b); | ||
let q1 = Lore.Statistics.getPercentile(newArr, 0.25); | ||
let q3 = Lore.Statistics.getPercentile(newArr, 0.75); | ||
let iqr = q3 - q1; | ||
let lower = q1 - (iqr * 1.5); | ||
let upper = q3 + (iqr * 1.5); | ||
let a = Lore.Statistics.getPercentile(newArr, q1); | ||
let b = Lore.Statistics.getPercentile(newArr, q3); | ||
let iqr = b - a; | ||
let lower = a - (iqr * k); | ||
let upper = b + (iqr * k); | ||
@@ -120,7 +121,8 @@ let diff = upper - lower; | ||
for (let i = 0; i < newArr.length; i++) { | ||
newArr[i] = (newArr[i] - lower) / diff; | ||
if (newArr[i] < 0.0) { | ||
if (newArr[i] < lower) { | ||
newArr[i] = 0.0; | ||
} else if (newArr[i] > 1.0) { | ||
} else if (newArr[i] > uppper) { | ||
newArr[i] = 1.0; | ||
} else { | ||
newArr[i] = (newArr[i] - lower) / diff; | ||
} | ||
@@ -127,0 +129,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
43903592
32509