Skip to content

Commit 60ee80d

Browse files
committed
refactoring if statements in shaders and scene
1 parent 95aa008 commit 60ee80d

9 files changed

+28
-18867
lines changed

package-lock.json

Lines changed: 15 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,21 +70,21 @@
7070
"es6-promise": "^3.0.2",
7171
"fast-isnumeric": "^1.1.1",
7272
"font-atlas-sdf": "^1.3.3",
73-
"gl-cone3d": "git://github.com/archmoj/gl-cone3d.git#823cabfbb19d8b457730320010cb58df748ff9ee",
73+
"gl-cone3d": "git://github.com/archmoj/gl-cone3d.git#2f1afdb49bd09e28ea32604b13aea919c0a57330",
7474
"gl-contour2d": "^1.1.4",
75-
"gl-error3d": "git://github.com/archmoj/gl-error3d.git#d09c224fe25671fcd588a8c803fe83129156fbab",
75+
"gl-error3d": "git://github.com/archmoj/gl-error3d.git#6b5180b0ed024430ccbafb7392dac087bb2c12c4",
7676
"gl-heatmap2d": "^1.0.4",
77-
"gl-line3d": "git://github.com/archmoj/gl-line3d.git#681398a5477f64cfd92ff7494215d5b6854e834b",
77+
"gl-line3d": "git://github.com/archmoj/gl-line3d.git#3f3e383004309507df9ce42490d85da070effafa",
7878
"gl-mat4": "^1.2.0",
79-
"gl-mesh3d": "git://github.com/archmoj/gl-mesh3d.git#5828f6255d8c5360631d5feec65801bb104a88e8",
79+
"gl-mesh3d": "git://github.com/archmoj/gl-mesh3d.git#b2da71e9cc4719ee5b6a69398651e578cef2f3c0",
8080
"gl-plot2d": "^1.3.1",
8181
"gl-plot3d": "git://github.com/archmoj/gl-plot3d.git#ce601a50cd3057899f6074f8ea5fcf0ab77f417c",
8282
"gl-pointcloud2d": "^1.0.1",
83-
"gl-scatter3d": "git://github.com/archmoj/gl-scatter3d.git#b649f8fb619242525b64ccf1def62cb2ed3f224f",
83+
"gl-scatter3d": "git://github.com/archmoj/gl-scatter3d.git#da56cdc37d4386261539d5134a5f9a39fe878415",
8484
"gl-select-box": "^1.0.2",
8585
"gl-spikes2d": "^1.0.1",
86-
"gl-streamtube3d": "git://github.com/archmoj/gl-streamtube3d.git#f4f5a63ffb19704a1ab1cadcc7aa848d7b68f7bf",
87-
"gl-surface3d": "git://github.com/archmoj/gl-surface3d.git#2455aad56d3727b940fad8d02727806abca0fdf4",
86+
"gl-streamtube3d": "git://github.com/archmoj/gl-streamtube3d.git#08ce753c40e2804f33738de987da5c10ec8c67c0",
87+
"gl-surface3d": "git://github.com/archmoj/gl-surface3d.git#cb6ef0af1b3d992112b9bfc83dcf2b4e4736e2d0",
8888
"gl-text": "^1.1.6",
8989
"glslify": "^6.3.1",
9090
"has-hover": "^1.0.1",

src/plots/gl3d/scene.js

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,6 @@ function computeTraceBounds(scene, trace, bounds) {
383383
}
384384
}
385385

386-
function isCloseToZero(a) {
387-
if(Math.abs(a) > Number.MIN_VALUE) { // the smallest positive numeric value representable in JavaScript
388-
return false;
389-
}
390-
return true;
391-
}
392-
393386
proto.plot = function(sceneData, fullLayout, layout) {
394387

395388
// Save parameters
@@ -442,8 +435,12 @@ proto.plot = function(sceneData, fullLayout, layout) {
442435
}
443436
var dataScale = [1, 1, 1];
444437
for(j = 0; j < 3; ++j) {
445-
var diff = dataBounds[1][j] - dataBounds[0][j];
446-
if(!isCloseToZero(diff)) dataScale[j] = 1.0 / diff;
438+
if(dataBounds[1][j] === dataBounds[0][j]) {
439+
dataScale[j] = 1.0;
440+
}
441+
else {
442+
dataScale[j] = 1.0 / (dataBounds[1][j] - dataBounds[0][j]);
443+
}
447444
}
448445

449446
// Save scale

0 commit comments

Comments
 (0)