Inconsistent Dolly with vtkInteractorStyleTrackballCamera
Here is the current implementation:
void vtkInteractorStyleTrackballCamera::Dolly(double factor)
{
if (this->CurrentRenderer == nullptr)
{
return;
}
vtkCamera *camera = this->CurrentRenderer->GetActiveCamera();
if (camera->GetParallelProjection())
{
camera->SetParallelScale(camera->GetParallelScale() / factor);
}
else
{
camera->Dolly(factor);
if (this->AutoAdjustCameraClippingRange)
{
this->CurrentRenderer->ResetCameraClippingRange();
}
}
if (this->Interactor->GetLightFollowCamera())
{
this->CurrentRenderer->UpdateLightsGeometryToFollowCamera();
}
this->Interactor->Render();
}
When in parallel projection mode the dolly will change the effective focal length of the camera. This causes an issue with 3d bounding boxes and plots that must always occupy most of the rendering window: when the focal length becomes small enough the nearest vertex of the bounding box moves behind the camera. This effect can be observed with vtkCubeAxesActor: as the camera zooms out the cube is forced to become smaller and smaller to prevent clipping. This is not a problem when parallel projection is disabled - focal length remains the same.
This issue can be resolved simply by commenting out the "else" line: always calling camera->Dolly(factor) and thus keeping focal length the same.
The downside is the loss of backward compatibility. This can be resolved by adding an additional property, PreserveFocalLength or some such. Won't be particularly pretty, though.