Displaying a polygon mesh

630 views
Skip to first unread message

Simon Kornblith

unread,
Nov 10, 2014, 9:09:29 PM11/10/14
to julia...@googlegroups.com
Is there an easy way to display a polygon mesh in Julia, i.e., vertices and faces loaded from an STL file or created by marching tetrahedra using Meshes.jl? So far, I see:
  • PyPlot/matplotlib, which seems to be surprisingly difficult to convince to do this.
  • GLPlot, which doesn't currently work for me on 0.4. (I haven't tried very hard yet.)
  • ihnorton's VTK bindings, which aren't registered in METADATA.jl.

Is there another option I'm missing? If not, can I convince one of these packages to show my mesh with minimal time investment, or should I use a separate volume viewer (or maybe a Python package via PyPlot)?

Thanks,
Simon

Steven G. Johnson

unread,
Nov 10, 2014, 10:36:01 PM11/10/14
to julia...@googlegroups.com


On Monday, November 10, 2014 9:09:29 PM UTC-5, Simon Kornblith wrote:
Is there an easy way to display a polygon mesh in Julia, i.e., vertices and faces loaded from an STL file or created by marching tetrahedra using Meshes.jl? So far, I see:


Mayavi via PyCall?

Erik Schnetter

unread,
Nov 10, 2014, 10:43:15 PM11/10/14
to julia...@googlegroups.com
I'm using Compose (and Color), on which Gadfly is built. I tried
Gadfly itself, but there were some inefficiencies -- I tried to
compose an image consisting of many different edges, and this many
independent graphs (I'm using the wrong terminology here) was not
handled well.

I've copy-and-pasted my plot routines at
<https://gist.github.com/eschnett/a9e7f70e4910e4ba2768> to give you an
example.

"circle" draws a filled circle (a vertex), and "line" draws a line (an
edge). I'm choosing colours depending on the z coordinate. The code
isn't self-contained, but should serve as example to see how
easy/complex this approach is.

-erik
--
Erik Schnetter <schn...@cct.lsu.edu>
http://www.perimeterinstitute.ca/personal/eschnetter/

Alex

unread,
Nov 11, 2014, 1:37:05 AM11/11/14
to julia...@googlegroups.com
Winston has an experimental/undocumented function surf + some stuff around it (https://github.com/nolta/Winston.jl/blob/master/src/canvas3d.jl), which might be sufficient if you just want to have a look at your meshes.

Best,

Alex.

On Tuesday, 11 November 2014 03:09:29 UTC+1, Simon Kornblith wrote:
> Is there an easy way to display a polygon mesh in Julia, i.e., vertices and faces loaded from an STL file or created by marching tetrahedra using Meshes.jl? So far, I see:

> PyPlot/matplotlib, which seems to be surprisingly difficult to convince to do this.GLPlot, which doesn't currently work for me on 0.4. (I haven't tried very hard yet.)

Miguel Bazdresch

unread,
Nov 11, 2014, 7:54:19 AM11/11/14
to julia...@googlegroups.com
Gaston has support for 3-D plotting via meshes (it uses gnuplot's surf command). I don't know if this does what you need, though. The documentation is here: https://bitbucket.org/mbaz/gaston/downloads/gastondoc-0.5.5.pdf


-- mb

On Mon, Nov 10, 2014 at 9:09 PM, Simon Kornblith <si...@simonster.com> wrote:

Simon Danisch

unread,
Nov 11, 2014, 9:56:53 AM11/11/14
to julia...@googlegroups.com
GLPlot master should work on 0.4!
(GLAbstraction, ModernGL, Reactive, GLWindow, all need to be master as well... If I get a few voices that master works for them, I might tag a the newer versions)

You can actually inofficially display Obj's, so there is mostly everything in place to display polygon meshes (https://github.com/twadleigh/Meshes.jl/issues/21).
If you have specific demands on how to display your datastracture, please open an issue, or contact me in some way.
I'm always interested in adding new visualizations to GLPlot! (My time right now is just a little sparse...)

Cheers,
Simon

Tracy Wadleigh

unread,
Nov 11, 2014, 3:13:47 PM11/11/14
to julia...@googlegroups.com
When developing Meshes.jl, I would dump a PLY (which, unlike STL, preserves topology) and view it with meshlab.

Steve Kelly

unread,
Nov 11, 2014, 3:33:30 PM11/11/14
to julia...@googlegroups.com
If you pull from master you should be able to just use threejs in IJulia: https://baconscript.github.io/Meshes.jl/

Miguel Belbut Gaspar

unread,
Nov 13, 2014, 5:51:14 PM11/13/14
to julia...@googlegroups.com
Hi Simon, I have used PyCall with MayaVi, which worked ok.

Miguel Belbut Gaspar

unread,
Nov 13, 2014, 5:58:51 PM11/13/14
to julia...@googlegroups.com
(I realize Steven had already suggested that)

@pyimport mayavi.mlab as Mlab
 mesh
=Mlab.test_triangulation_mesh()

Jiahao Chen

unread,
Nov 18, 2014, 11:23:50 AM11/18/14
to julia...@googlegroups.com
Sheehan Olver gave an excellent demo at the Supercomputing conference yesterday showing off GLPlot for plotting solutions of PDEs in 3D.

It didn't quite work on a dual display setup but it was very fun to look at on his laptop screen.

Erik Schnetter

unread,
Nov 18, 2014, 1:57:30 PM11/18/14
to julia...@googlegroups.com
Are there slides from this demo?

-erik

Jiahao Chen

unread,
Nov 20, 2014, 5:28:57 PM11/20/14
to julia...@googlegroups.com
Not yet, but Sheehan will be reprising his talk later this evening:


We're going to try live streaming and recording the session.

Thanks,

Jiahao Chen
Staff Research Scientist
MIT Computer Science and Artificial Intelligence Laboratory
Reply all
Reply to author
Forward
0 new messages