Skip to content

Commit bc8334b

Browse files
committed
applied distinctVals
1 parent c66a2bb commit bc8334b

20 files changed

+18
-73
lines changed

src/traces/isosurface/attributes.js

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,6 @@ function makeCapAttr(axLetter) {
8484
}
8585

8686
var attrs = module.exports = overrideAll(extendFlat({
87-
88-
width: {
89-
valType: 'integer',
90-
role: 'info',
91-
description: [
92-
'Sets the number of points on X axis.'
93-
].join(' ')
94-
},
95-
height: {
96-
valType: 'integer',
97-
role: 'info',
98-
description: [
99-
'Sets the number of points on Y axis.'
100-
].join(' ')
101-
},
102-
depth: {
103-
valType: 'integer',
104-
role: 'info',
105-
description: [
106-
'Sets the number of points on Z axis.'
107-
].join(' ')
108-
},
10987
x: {
11088
valType: 'data_array',
11189
role: 'info',

src/traces/isosurface/calc.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ var colorscaleCalc = require('../../components/colorscale/calc');
1212

1313
module.exports = function calc(gd, trace) {
1414

15+
trace._len = Math.min(trace.x.length, trace.y.length, trace.z.length, trace.value.length);
16+
1517
var min = Infinity;
1618
var max = -Infinity;
1719
var len = trace.value.length;

src/traces/isosurface/convert.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ var createMesh = require('gl-mesh3d');
1414
var parseColorScale = require('../../lib/gl_format_color').parseColorScale;
1515
var str2RgbaArray = require('../../lib/str2rgbarray');
1616
var zip3 = require('../../plots/gl3d/zip3');
17+
var Lib = require('../../lib');
18+
19+
function distinctVals(col) {
20+
return Lib.distinctVals(col).vals;
21+
}
1722

1823
function IsosurfaceTrace(scene, mesh, uid) {
1924
this.scene = scene;
@@ -154,9 +159,13 @@ function generateIsosurfaceMesh(data) {
154159
var numVertices;
155160
var beginVertextLength;
156161

157-
var width = data.width;
158-
var height = data.height;
159-
var depth = data.depth;
162+
var Xs = distinctVals(data.x.slice(0, data._len));
163+
var Ys = distinctVals(data.y.slice(0, data._len));
164+
var Zs = distinctVals(data.z.slice(0, data._len));
165+
166+
var width = Xs.length;
167+
var height = Ys.length;
168+
var depth = Zs.length;
160169

161170
function getIndex(i, j, k) {
162171
return k + depth * j + depth * height * i;

src/traces/isosurface/defaults.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,16 @@ module.exports = function supplyDefaults(traceIn, traceOut, defaultColor, layout
3030
traceOut.isomax = null;
3131
}
3232

33-
var width = coerce('width');
34-
var height = coerce('height');
35-
var depth = coerce('depth');
36-
var numVertices = width * height * depth;
37-
3833
var x = coerce('x');
3934
var y = coerce('y');
4035
var z = coerce('z');
4136
var value = coerce('value');
4237

4338
if(
44-
!x || !x.length || x.length !== numVertices ||
45-
!y || !y.length || y.length !== numVertices ||
46-
!z || !z.length || z.length !== numVertices ||
47-
!value || !value.length || value.length !== numVertices
39+
!x || !x.length ||
40+
!y || !y.length ||
41+
!z || !z.length ||
42+
!value || !value.length
4843
) {
4944
traceOut.visible = false;
5045
return;
Loading
Loading
Loading
-714 Bytes
Loading

test/image/mocks/gl3d_isosurface_1single-surface_middle-range.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 25,
23-
"height": 25,
24-
"depth": 25,
2522
"isomin": 250,
2623
"isomax": 1250,
2724
"value": [

test/image/mocks/gl3d_isosurface_2surfaces-checker_spaceframe.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 25,
23-
"height": 25,
24-
"depth": 25,
2522
"isomin": 250,
2623
"isomax": 1250,
2724
"value": [

test/image/mocks/gl3d_isosurface_5more-surfaces_between-ranges.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 25,
23-
"height": 25,
24-
"depth": 25,
2522
"isomin": 250,
2623
"isomax": 1250,
2724
"value": [

test/image/mocks/gl3d_isosurface_log-axis_slices_surface-fill.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": true,
2020
"width": 4
2121
},
22-
"width": 21,
23-
"height": 21,
24-
"depth": 21,
2522
"isomin": 200,
2623
"isomax": 500,
2724
"value": [

test/image/mocks/gl3d_isosurface_math.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 41,
23-
"height": 41,
24-
"depth": 41,
2522
"isomin": 4.0,
2623
"isomax": 40.0,
2724
"value": [

test/image/mocks/gl3d_isosurface_multiple-traces.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@
2020
"show": false,
2121
"width": 4
2222
},
23-
"width": 9,
24-
"height": 9,
25-
"depth": 9,
2623
"isomin": 150,
2724
"isomax": 250,
2825
"value": [
@@ -413,9 +410,6 @@
413410
"show": false,
414411
"width": 4
415412
},
416-
"width": 9,
417-
"height": 9,
418-
"depth": 9,
419413
"isomin": 150,
420414
"isomax": 250,
421415
"value": [

test/image/mocks/gl3d_isosurface_out_of_iso_range_case.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": true,
2020
"width": 4
2121
},
22-
"width": 8,
23-
"height": 6,
24-
"depth": 4,
2522
"isomin": -1010,
2623
"isomax": 1010,
2724
"value": [

test/image/mocks/gl3d_isosurface_thin_caps_different_dims.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 41,
23-
"height": 21,
24-
"depth": 11,
2522
"isomin": 220,
2623
"isomax": 240,
2724
"value": [

test/image/mocks/gl3d_isosurface_uneven-scales_ranges_iso-null.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 21,
23-
"height": 21,
24-
"depth": 21,
2522
"isomin": -200,
2623
"isomax": null,
2724
"value": [

test/image/mocks/gl3d_isosurface_with_surface-pattern.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 21,
23-
"height": 21,
24-
"depth": 21,
2522
"isomin": 1000,
2623
"isomax": 1500,
2724
"value": [

test/image/mocks/gl3d_isosurface_xycaps_volume_slices.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,6 @@
1919
"show": false,
2020
"width": 4
2121
},
22-
"width": 26,
23-
"height": 26,
24-
"depth": 26,
2522
"isomin": 200,
2623
"isomax": 800,
2724
"value": [

test/jasmine/tests/isosurface_test.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ function createIsosurfaceFig() {
1414
return {
1515
data: [{
1616
type: 'isosurface',
17-
width: 4,
18-
height: 4,
19-
depth: 4,
2017
x: [
2118
0.1, 0.1, 0.1, 0.1,
2219
0.1, 0.1, 0.1, 0.1,

0 commit comments

Comments
 (0)