8000 3D streamtube traces by etpinard · Pull Request #2658 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

3D streamtube traces #2658

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 41 commits into from
Jul 5, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
616d043
streamtube integration, first pass
kig May 20, 2018
2435a96
add gl-streamtube to package.json
kig May 20, 2018
355aed1
add gl-streamtube3d to package-lock
etpinard May 23, 2018
583499f
use gl-streamtube3d version that works on etpinard's laptop
etpinard May 23, 2018
39c254e
cleanup streamtube/
etpinard May 24, 2018
38a1310
add first streamtube mock
etpinard May 24, 2018
971351c
properly scaffold streamtube trace module
etpinard May 24, 2018
218dfc8
factor out zip3 into src/lib/
etpinard May 24, 2018
1367c07
Merge branch 'master' into streamtube-traces
etpinard May 24, 2018
8ea0c25
add 'sizeref'
etpinard May 29, 2018
3b1f809
fixup streamtube-thin baseline
etpinard May 29, 2018
b0cd99d
fixup cmin/cmax -> vertexIntensityBounds,
etpinard Jun 1, 2018
e99ffc9
expect x/y/z and u/v/w to have matching length + add tube bounds pad
etpinard Jun 1, 2018
e0ff37f
first cut streamtube hover
etpinard Jun 1, 2018
fbd7980
fixup hoverinfo 'norm'
etpinard Jun 1, 2018
f5c1160
add support for u/v/w hoverinfo flags
etpinard Jun 4, 2018
b9a6e3f
add cone + streamtube mock
etpinard Jun 4, 2018
80bcd84
use gl-streamtube3d 'tubeScale' to fit tubes inside scene
etpinard Jun 4, 2018
273292d
make startx/starty/startz optional
etpinard Jun 4, 2018
5da1c59
fix cone <-> streamtube restyle
etpinard Jun 4, 2018
8531e23
first cut streamtube jasmine tests
etpinard Jun 4, 2018
94f6195
add 'divergence' hoverinfo flag
etpinard Jun 4, 2018
c40dd6b
add support for 'text' (scalar value only)
etpinard Jun 5, 2018
8182cab
comment out 'sizemode' (for now)
etpinard Jun 5, 2018
62b90b5
hook in 'maxLength' as 'maxdisplayed'
etpinard Jun 5, 2018
dc0c5d7
improve streamtube attr descriptions
etpinard Jun 5, 2018
bf12d10
add streamtube to Plotly.react-noop suite
etpinard Jun 5, 2018
df7ccaa
emit custom event data for streamtube
etpinard Jun 5, 2018
ca7c022
typos in streamtube meta
alexcjohnson Jun 5, 2018
9a53250
fixup hoverinfo: 'all' for cone traces
etpinard Jun 6, 2018
22f0c7e
sub startx/starty/startz -> starts.(x|y|z)
etpinard Jun 6, 2018
d796bda
fixup 'starts' attribute declaration
etpinard Jun 6, 2018
2d1df2b
Merge branch 'master' into streamtube-traces
etpinard Jun 12, 2018
0093ac8
fixup streamtube after merge master
etpinard Jun 12, 2018
5c2ddfc
mv lib/zip3 -> plots/gl3d/zip3
etpinard Jun 18, 2018
9fa5ece
add 'len' argument to zip3
etpinard Jun 18, 2018
d33fc45
merge all colorscale attribute generator in one function
etpinard Jun 18, 2018
9e3c533
fix #2723 - list correct 'color' attribute in cone,
etpinard Jun 18, 2018
83f3bdc
improve auto starting position algo
etpinard Jun 19, 2018
f348ac3
Merge branch 'master' into streamtube-traces
etpinard Jul 5, 2018
966bc8d
use gl-streamtube3d@1.0.0
etpinard Jul 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
cleanup streamtube/
- reuse cone colorbar
- compute x/y/z bounds in calc
- pass cmin/cmax to meshData.vertexIntensityBounds
- rename starting position attributes
  cx/cy/cz -> startx/starty/startz
- misc cleanup to bring streamtube closer to cone
- add new TODOs
  • Loading branch information
etpinard committed May 24, 2018
commit 39c254e4f159c504fede1c6d8bec38242f85412a
95 changes: 37 additions & 58 deletions src/traces/streamtube/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,95 +19,67 @@ var extendFlat = require('../../lib/extend').extendFlat;
var attrs = {
x: {
valType: 'data_array',
editType: 'calc',
description: ''
role: 'info',
editType: 'calc+clearAxisTypes',
description: 'Sets the x coordinates of the vector field'
},
y: {
valType: 'data_array',
editType: 'calc'
role: 'info',
editType: 'calc+clearAxisTypes',
description: 'Sets the y coordinates of the vector field'
},
z: {
valType: 'data_array',
editType: 'calc'
role: 'info',
editType: 'calc+clearAxisTypes',
description: 'Sets the z coordinates of the vector field'
},

u: {
valType: 'data_array',
editType: 'calc',
description: [
].join(' ')
description: 'Sets the x components of the vector field.'
},
v: {
valType: 'data_array',
editType: 'calc',
description: [
].join(' ')

description: 'Sets the y components of the vector field.'
},
w: {
valType: 'data_array',
editType: 'calc',
description: [
].join(' ')

},

cx: {
valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: [
].join(' ')
},
cy: {
valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: [
].join(' ')
},
cz: {
valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: [
].join(' ')
description: 'Sets the z components of the vector field.'
},

bounds: {
startx: {
valType: 'data_array',
editType: 'calc+clearAxisTypes',
description: [
].join(' ')
},

colormap: {
valType: 'string',
role: 'style',
editType: 'calc',
description: [
'Sets the x components of the starting position of the streamtubes',
''
].join(' ')
},

maxLength: {
valType: 'number',
min: 1,
dflt: 1000,
starty: {
valType: 'data_array',
editType: 'calc',
description: [
'Sets the y components of the starting position of the streamtubes',
''
].join(' ')
},

widthScale: {
valType: 'number',
role: 'style',
min: 0,
dflt: 100,
startz: {
valType: 'data_array',
editType: 'calc',
description: [
'Sets the z components of the starting position of the streamtubes',
''
].join(' ')
},

// TODO
// sizemode: {},
// sizescale: {},
// maxLength
// widthScale

text: {
valType: 'string',
Expand All @@ -116,22 +88,29 @@ var attrs = {
arrayOk: true,
editType: 'calc',
description: [

'Sets the text elements associated with the cones.',
'If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,',
'these elements will be seen in the hover labels.'
].join(' ')
}
};

extendFlat(attrs, colorAttrs('', 'calc', false), {
extendFlat(attrs, colorAttrs('', 'calc', true), {
showscale: colorscaleAttrs.showscale,
colorbar: colorbarAttrs
});
delete attrs.color;

var fromMesh3d = ['opacity', 'flatshading', 'lightposition', 'lighting'];

var fromMesh3d = ['opacity', 'lightposition', 'lighting'];
fromMesh3d.forEach(function(k) {
attrs[k] = mesh3dAttrs[k];
});

attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, {editType: 'calc'});
// TODO maybe add divergence field?
attrs.hoverinfo = extendFlat({}, baseAttrs.hoverinfo, {
editType: 'calc',
flags: ['x', 'y', 'z', 'u', 'v', 'w', 'norm', 'text', 'name'],
dflt: 'x+y+z+norm+text+name'
});

module.exports = attrs;
70 changes: 68 additions & 2 deletions src/traces/streamtube/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,73 @@
var colorscaleCalc = require('../../components/colorscale/calc');

module.exports = function calc(gd, trace) {
if(trace.intensity) {
colorscaleCalc(trace, trace.intensity, '', 'c');
var i;

var u = trace.u;
var v = trace.v;
var w = trace.w;
var vlen = Math.min(u.length, v.length, w.length);
var normMax = -Infinity;
var normMin = Infinity;

for(i = 0; i < vlen; i++) {
var uu = u[i];
var vv = v[i];
var ww = w[i];
var norm = Math.sqrt(uu * uu + vv * vv + ww * ww);

normMax = Math.max(normMax, norm);
normMin = Math.min(normMin, norm);
}

colorscaleCalc(trace, [normMin, normMax], '', 'c');

var xMax = -Infinity;
var xMin = Infinity;
var yMax = -Infinity;
var yMin = Infinity;
var zMax = -Infinity;
var zMin = Infinity;

var x = trace.x;
var y = trace.y;
var z = trace.z;
var plen = Math.min(x.length, y.length, z.length);

for(i = 0; i < plen; i++) {
var xx = x[i];
xMax = Math.max(xMax, xx);
xMin = Math.min(xMin, xx);

var yy = y[i];
yMax = Math.max(yMax, yy);
yMin = Math.min(yMin, yy);

var zz = z[i];
zMax = Math.max(zMax, zz);
zMin = Math.min(zMin, zz);
}

var startx = trace.startx;
var starty = trace.starty;
var startz = trace.startz;
var slen = Math.min(startx.length, starty.length, startz.length);

for(i = 0; i < slen; i++) {
var sx = startx[i];
xMax = Math.max(xMax, sx);
xMin = Math.min(xMin, sx);

var sy = starty[i];
yMax = Math.max(yMax, sy);
yMin = Math.min(yMin, sy);

var sz = startz[i];
zMax = Math.max(zMax, sz);
zMin = Math.min(zMin, sz);
}

trace._xbnds = [xMin, xMax];
trace._ybnds = [yMin, yMax];
trace._zbnds = [zMin, zMax];
};
48 changes: 0 additions & 48 deletions src/traces/streamtube/colorbar.js

This file was deleted.

Loading
0