-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New code for isosurface trace #3340
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
Changes from 29 commits
71ae66e
be3c5a5
dfe2a85
251b2d4
cd86716
66bf59d
dee7c8e
b2b7bc0
0ac65d9
f5c6052
e5c7ff0
e60de84
0a9bf1d
eecd804
b1f7939
8779a6a
2a4b9fb
08e1508
4b49dc4
07e11c0
06531f8
87ae392
af9294b
f141098
04cc4b4
a10b365
16208cb
b2f84be
605ce44
56b4df1
5311b01
0171bf6
1da04df
4ac90eb
49aa746
d9c1fa7
79fdb19
de20714
341ba29
dac7f9d
94f0767
7c7bbe5
9e5441d
940b41f
dd08cd4
530cdb4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
module.exports = require('../src/traces/isosurface'); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,184 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var colorscaleAttrs = require('../../components/colorscale/attributes'); | ||
var colorbarAttrs = require('../../components/colorbar/attributes'); | ||
var surfaceAtts = require('../surface/attributes'); | ||
var baseAttrs = require('../../plots/attributes'); | ||
|
||
var extendFlat = require('../../lib/extend').extendFlat; | ||
|
||
module.exports = extendFlat({ | ||
x: { | ||
valType: 'data_array', | ||
role: 'info', | ||
editType: 'calc+clearAxisTypes', | ||
description: [ | ||
'Sets the X coordinates of the vertices on X axis.' | ||
].join(' ') | ||
}, | ||
y: { | ||
valType: 'data_array', | ||
role: 'info', | ||
editType: 'calc+clearAxisTypes', | ||
description: [ | ||
'Sets the Y coordinates of the vertices on Y axis.' | ||
].join(' ') | ||
}, | ||
z: { | ||
valType: 'data_array', | ||
role: 'info', | ||
editType: 'calc+clearAxisTypes', | ||
description: [ | ||
'Sets the Z coordinates of the vertices on Z axis.' | ||
].join(' ') | ||
}, | ||
volume: { | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
valType: 'data_array', | ||
role: 'info', | ||
editType: 'calc', | ||
description: [ | ||
'Sets the 4th dimension of the vertices.' | ||
].join(' ') | ||
}, | ||
isocap: { | ||
valType: 'boolean', | ||
role: 'info', | ||
editType: 'calc', | ||
dflt: false, | ||
description: [ | ||
'Enable caps between minimum and maximum iso values.' | ||
].join(' ') | ||
}, | ||
isovalue: { | ||
valType: 'data_array', | ||
role: 'info', | ||
editType: 'calc', | ||
dflt: [0], | ||
description: [ | ||
'Sets iso surface boundaries.' | ||
].join(' ') | ||
}, | ||
meshalgo: { | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
valType: 'string', | ||
role: 'info', | ||
dflt: 'MarchingCubes', | ||
editType: 'calc', | ||
description: [ | ||
'Sets the isosurface polygonizer algorithm:', | ||
'including: `MarchingCubes` (i.e. default),', | ||
'`MarchingTetrahedra` or `SurfaceNets`.' | ||
].join(' ') | ||
}, | ||
|
||
text: { | ||
valType: 'string', | ||
role: 'info', | ||
dflt: '', | ||
arrayOk: true, | ||
editType: 'calc', | ||
description: [ | ||
'Sets the text elements associated with the vertices.', | ||
'If trace `hoverinfo` contains a *text* flag and *hovertext* is not set,', | ||
'these elements will be seen in the hover labels.' | ||
].join(' ') | ||
}, | ||
|
||
// Color field | ||
color: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we really need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Reduced color attributes in 49aa746 |
||
valType: 'color', | ||
role: 'style', | ||
editType: 'calc', | ||
description: 'Sets the color of the whole isosurface' | ||
}, | ||
vertexcolor: { | ||
valType: 'data_array', | ||
role: 'style', | ||
editType: 'calc', | ||
description: [ | ||
'Sets the color of each vertex', | ||
'Overrides *color*.' | ||
].join(' ') | ||
}, | ||
facecolor: { | ||
valType: 'data_array', | ||
role: 'style', | ||
editType: 'calc', | ||
description: [ | ||
'Sets the color of each face', | ||
'Overrides *color* and *vertexcolor*.' | ||
].join(' ') | ||
}, | ||
transforms: undefined | ||
}, | ||
|
||
colorscaleAttrs('', { | ||
colorAttr: '`intensity`', | ||
archmoj marked this conversation as resolved.
Show resolved
Hide resolved
|
||
showScaleDflt: true, | ||
editTypeOverride: 'calc' | ||
}), { | ||
|
||
colorbar: colorbarAttrs, | ||
|
||
opacity: surfaceAtts.opacity, | ||
|
||
// Flat shaded mode | ||
flatshading: { | ||
valType: 'boolean', | ||
role: 'style', | ||
dflt: false, | ||
editType: 'calc', | ||
description: [ | ||
'Determines whether or not normal smoothing is applied to the isosurfaces,', | ||
'creating isosurfaces with an angular, low-poly look via flat reflections.' | ||
].join(' ') | ||
}, | ||
|
||
contour: { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The contours seem to be working on hover namely on caps. |
||
show: extendFlat({}, surfaceAtts.contours.x.show, { | ||
description: [ | ||
'Sets whether or not dynamic contours are shown on hover' | ||
].join(' ') | ||
}), | ||
color: surfaceAtts.contours.x.color, | ||
width: surfaceAtts.contours.x.width, | ||
editType: 'calc' | ||
}, | ||
|
||
lightposition: { | ||
x: extendFlat({}, surfaceAtts.lightposition.x, {dflt: 1e5}), | ||
y: extendFlat({}, surfaceAtts.lightposition.y, {dflt: 1e5}), | ||
z: extendFlat({}, surfaceAtts.lightposition.z, {dflt: 0}), | ||
editType: 'calc' | ||
}, | ||
lighting: extendFlat({ | ||
vertexnormalsepsilon: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 1, | ||
dflt: 1e-12, // otherwise finely tessellated things eg. the brain will have no specular light reflection | ||
editType: 'calc', | ||
description: 'Epsilon for vertex normals calculation avoids math issues arising from degenerate geometry.' | ||
}, | ||
facenormalsepsilon: { | ||
valType: 'number', | ||
role: 'style', | ||
min: 0.00, | ||
max: 1, | ||
dflt: 1e-6, // even the brain model doesn't appear to need finer than this | ||
editType: 'calc', | ||
description: 'Epsilon for face normals calculation avoids math issues arising from degenerate geometry.' | ||
}, | ||
editType: 'calc' | ||
}, surfaceAtts.lighting), | ||
|
||
hoverinfo: extendFlat({}, baseAttrs.hoverinfo, {editType: 'calc'}) | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* Copyright 2012-2018, Plotly, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
'use strict'; | ||
|
||
var colorscaleCalc = require('../../components/colorscale/calc'); | ||
|
||
module.exports = function calc(gd, trace) { | ||
colorscaleCalc(gd, trace, { | ||
vals: trace.isovalue, | ||
containerStr: '', | ||
cLetter: 'c' | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mikolalysenko/isosurface@master...archmoj:plotly-integration