goniometer.py 667 B

12345678910111213141516171819202122232425262728
  1. """The 3D-ruler axes and a goniometer"""
  2. from vedo import *
  3. settings.use_parallel_projection = True # avoid parallax effects
  4. mesh = Cone().rotate_y(90).pos([1, 2, 3])
  5. mesh.c("steelblue")
  6. # measure the angle formed by 3 points
  7. gon = Goniometer(
  8. [-0.5, 1, 2], [2.5, 2, 2], [-0.5, 3, 3],
  9. prefix=":alpha_c =~", lw=2, s=0.8
  10. )
  11. # show distance of any 2 points
  12. rul = Ruler3D(
  13. (-0.5, 2, 1.9),
  14. (2.5, 2, 2.9),
  15. prefix="L_x =",
  16. units="μm",
  17. axis_rotation=90,
  18. tick_angle=70,
  19. )
  20. # make 3d rulers along the bounding box (similar to set axes=7)
  21. ax3 = RulerAxes(mesh, units="μm")
  22. show(mesh, gon, rul, ax3, __doc__, bg2="lb", viewup="z").close()