Skip to content
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

New code for isosurface trace #3340

Closed
wants to merge 46 commits into from
Closed

New code for isosurface trace #3340

wants to merge 46 commits into from

Conversation

archmoj
Copy link
Contributor

@archmoj archmoj commented Dec 17, 2018

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

@@ -70,6 +70,7 @@
"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
Contributor Author

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
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.

@etpinard
Copy link
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

 var width = 64
    var height = 64
    var depth = 64
    var isomin = 1600
    var isomax = 2000

    var xs = []
    var ys = []
    var zs = []

    var data = new Uint16Array(width*height*depth)
    var k = 0
    for (var z=0; z<depth; z++)
    for (var y=0; y<height; y++)
    for (var x=0; x<width; x++) {
        xs.push(x/width)
        ys.push(y/height)
        zs.push(z/depth)
        data[k] = x < width/2 ? isomax+1 : isomin-1
	k++
    }

    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
Copy link
Contributor Author

archmoj commented Dec 19, 2018

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

@archmoj
Copy link
Contributor Author

archmoj commented Dec 20, 2018

@etpinard demo link related to #2752 (comment)

@etpinard etpinard added this to the 1.44.0 milestone Dec 21, 2018
@etpinard
Copy link
Contributor

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

@archmoj archmoj closed this Jan 15, 2019
@etpinard etpinard deleted the isosurface-new branch January 15, 2019 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants