export_x3d.py 656 B

1234567891011121314151617181920
  1. """Embed a 3D scene
  2. in a webpage with x3d"""
  3. from vedo import dataurl, Plotter, Volume, Text3D
  4. plt = Plotter(size=(800,600), bg='GhostWhite')
  5. embryo = Volume(dataurl+'embryo.tif').isosurface().decimate(0.5)
  6. coords = embryo.coordinates
  7. embryo.cmap('PRGn', coords[:,1]) # add dummy colors along y
  8. txt = Text3D(__doc__, font='Bongas', s=350, c='red2', depth=0.05)
  9. txt.pos(2500, 300, 500)
  10. plt.show(embryo, txt, txt.box(padding=250), axes=1, viewup='z', zoom=1.2)
  11. # This exports the scene and generates 2 files:
  12. # embryo.x3d and an example embryo.html to inspect in the browser
  13. plt.export('embryo.x3d', binary=False)
  14. print("Type: \n firefox embryo.html")