[Python] Set Pyvista Camera position object disappear

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    I am using pyvista to produce a gif animation. My object is a square [0,10]×[0,10] located on the xy-plane (z-coordinate = 0).

    I want to set the camera position to the center of the square which is (5,5,0) when viewed from above. I used the following code:

    plotter.camera.position = [5.0, 5.0, 25]
    plotter.camera.focal_point = [5.0, 5.0, 0]
    plotter.camera.roll += 90


    However, the square becomes completely invisible. No matter how I use the mouse to reorient in the preview environment, I can not find the object at all.

    Then I just changed it a little bit by

    plotter.camera.focal_point = [4.999, 5.0, 0]


    Then it appears. It seems that as long as camera.position and camera.focal_point have equal x- and y-coordinates (z-coordinates don't matter), the object always becomes invisible.

    But, I would like to know what is going on here and understand how pyvista.camera works.

    Continue reading...

Compartilhe esta Página