inset.py 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. """Render meshes into inset windows
  2. (which can be dragged)"""
  3. from vedo import *
  4. plt = Plotter(bg2='bisque', size=(1000,800), interactive=False)
  5. e = Volume(dataurl+"embryo.tif").isosurface()
  6. e.normalize().shift(-2,-1.5,-2).c("gold")
  7. plt.show(e, __doc__, viewup='z')
  8. # make clone copies of the embryo surface and cut them:
  9. e1 = e.clone().cut_with_plane(normal=[0,1,0]).c("green4")
  10. e2 = e.clone().cut_with_plane(normal=[1,0,0]).c("red5")
  11. # add 2 draggable inset windows:
  12. plt.add_inset(e1, pos=(0.9,0.8))
  13. plt.add_inset(e2, pos=(0.9,0.5))
  14. # customised axes can also be inserted:
  15. ax = Axes(
  16. xrange=(0,1), yrange=(0,1), zrange=(0,1),
  17. xtitle='front', ytitle='left', ztitle='head',
  18. yzgrid=False, xtitle_size=0.15, ytitle_size=0.15, ztitle_size=0.15,
  19. xlabel_size=0, ylabel_size=0, zlabel_size=0, tip_size=0.05,
  20. axes_linewidth=2, xline_color='dr', yline_color='dg', zline_color='db',
  21. xtitle_offset=0.05, ytitle_offset=0.05, ztitle_offset=0.05,
  22. )
  23. ex = e.clone().scale(0.25).pos(0,0.1,0.1).alpha(0.1).lighting('off')
  24. plt.add_inset(ax, ex, pos=(0.1,0.1), size=0.15, draggable=False)
  25. plt.interactive().close()