how to set the camera to a fixed focus camera

Hi everyone,
I want to know is there any function in vtk that can set the camera to a fixed focus camera? I want the focal length to be a fixed constant which won’t change when I move my camera.
I use python vtk 8.2.0.
Thank you!

Hi,

Did you solve your issue? I’m not sure to understand what you want.

When you move your camera’s position, it doesn’t change your target position (ie FocalPoint). Do you want to keep the distance between camera’s position and its focal point constant, or do you mean the FocalDistance that is used for focus when using ray tracing renderers?

As far as I’m aware, there is no function that allows setting a constant distance between camera’s position and its focal point but you may find useful the Distance property that moves the FocalPoint to a given distance from Position or DirectionOfProjection that gives the direction from the camera position to the focal point.

I don’t quite understand the question, either. But I’ll make a guess that it’s really a question about interaction.

With VTK’s default interaction style, when you “zoom in”, it moves the camera closer to the focal point. This changes the distance, and therefore changes the perspective. There is no interaction style in VTK that allows you to “zoom in” by changing the field of view (and hence keeping the same perspective).

The only simple way around this is to call camera.ParallelProjectionOn(), which turns perspective off completely. If you don’t need perspective, this is the best solution.

But if you do need perspective, but need to keep the perspective constant, the only real solution is to customize the VTK interaction (which is possible). A custom interaction mode that used camera.SetViewAngle() would be able to change the field of view without changing the perspective.

Thanks a lot for your kind reply!
I think what you’re saying is exactly what I want.I found when I use Right Click to move my camera,the camera position is changed but focalpoint isn’t move.I wish the distance between camera position and focalpoint won’t change because my real camera is a fixed-focus camera.Now I use interactor.AddObserver to move camera and let the distance be fixed by SetPosition and SetFocalPoint.