Skip to content

New code for isosurface trace - #3340

Closed
archmoj wants to merge 46 commits into
masterfrom
isosurface-new
Closed

New code for isosurface trace#3340
archmoj wants to merge 46 commits into
masterfrom
isosurface-new

Conversation

@archmoj

@archmojarchmoj commented Dec 17, 2018

Copy link
Copy Markdown
Contributor

Supersedes #3311 i.e. without using gl-isosurface3d refactored code!
Totally rewritten and based on plotly.js most recent source code for mesh3d trace.
Also in this regard, the isosurface module which used to support various algorithms namely marching-cube, marching-tetrahedra & surface-nets for displaying mathematical functions is forked and improved to accept data cubes.
Using isovalue attribute the user may create one, two or multiple 3D contour surfaces.
It is possible to enable isocap surfaces too.

Various iso-surface traces could be modelled using this manual demo or this auto-update demo.

gl3d_isosurface_math

@plotly/plotly_js

Comment threadpackage.json
"es6-promise": "^3.0.2",
"fast-isnumeric": "^1.1.2",
"font-atlas-sdf": "^1.3.3",
"isosurface": "git://github.com/archmoj/isosurface.git#e2c41594417a2ba363bb430c7d38adfe18312fc5",

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


var gl = scene.glplot.gl;

var mesh = createMesh({gl: gl});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reusing gl-mesh3d is a very nice idea. One drawback I noticed though: hover labels don't appear on the input data coordinates, they appear on the (interpolated) mesh x/y/z - which I think is ok for now, albeit not consistent with our other trace types. For example, surface hover always picks out data-coordinates (even when the surface coordinates are refined). In contrast, streamtubes hover picks the coordinates on the tubes themselves.

Comment threadsrc/traces/isosurface/defaults.js Outdated
Comment threadtest/image/mocks/gl3d_isosurface_math.json Outdated
@etpinard

Copy link
Copy Markdown
Contributor

@archmoj nice work! Your code and algo look very good, reusing gl-mesh3d makes it very easy to digest!


Now, I'm trying to verify concerns from #2752 (comment) - pasting

varwidth=64varheight=64vardepth=64varisomin=1600varisomax=2000varxs=[]varys=[]varzs=[]vardata=newUint16Array(width*height*depth)vark=0for(varz=0;z<depth;z++)for(vary=0;y<height;y++)for(varx=0;x<width;x++){xs.push(x/width)ys.push(y/height)zs.push(z/depth)data[k]=x<width/2 ? isomax+1 : isomin-1k++}Plotly.newPlot(gd,[{type: 'isosurface',x: xs,y: ys,z: zs,volume: data,isomin: isomin,isomax: isomax,cmin: isomin-100,cmax: isomax+100,smoothnormals: true,isocaps: true,singlemesh: true,colorscale: 'Portland',capscolorscale: 'Jet'}],{scene: {xaxis: {range: [0,1]},yaxis: {range: [0,1]},zaxis: {range: [0,1]}}})

appears to result in an infinite loop. Am I doing anything wrong?

@archmoj

archmoj commented Dec 19, 2018

Copy link
Copy Markdown
ContributorAuthor

@etpinard This is a demo related to the comment that you mentioned: #2752 (comment)

@archmoj

Copy link
Copy Markdown
ContributorAuthor

@etpinard demo link related to #2752 (comment)

@etpinardetpinard added this to the 1.44.0 milestone Dec 21, 2018
@etpinard

Copy link
Copy Markdown
Contributor

Can we close this PR, now that #3438 is up?

@archmojarchmoj closed this Jan 15, 2019
@etpinard
etpinard deleted the isosurface-new branch January 15, 2019 22:15
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

featuresomething new

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants

@archmoj@jackparmer@empet@etpinard@alexcjohnson