camera.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. from paraview import simple
  2. from vtkmodules.web import camera
  3. def update_camera(viewProxy, cameraData):
  4. viewProxy.CameraFocalPoint = cameraData["focalPoint"]
  5. viewProxy.CameraPosition = cameraData["position"]
  6. viewProxy.CameraViewUp = cameraData["viewUp"]
  7. simple.Render(viewProxy)
  8. def create_spherical_camera(viewProxy, dataHandler, phiValues, thetaValues):
  9. return camera.SphericalCamera(
  10. dataHandler,
  11. viewProxy.CenterOfRotation,
  12. viewProxy.CameraPosition,
  13. viewProxy.CameraViewUp,
  14. phiValues,
  15. thetaValues,
  16. )
  17. def create_cylindrical_camera(viewProxy, dataHandler, phiValues, translationValues):
  18. return camera.CylindricalCamera(
  19. dataHandler,
  20. viewProxy.CenterOfRotation,
  21. viewProxy.CameraPosition,
  22. viewProxy.CameraViewUp,
  23. phiValues,
  24. translationValues,
  25. )
  26. def create_cube_camera(viewProxy, dataHandler, viewForward, viewUp, positions):
  27. return camera.CubeCamera(dataHandler, viewForward, viewUp, positions)
  28. def create_stereo_cube_camera(
  29. viewProxy, dataHandler, viewForward, viewUp, positions, eyeSeparation=6.5
  30. ):
  31. return camera.StereoCubeCamera(
  32. dataHandler, viewForward, viewUp, positions, eyeSeparation
  33. )