From fd673997fcc41427b2b23d2cdad712515ea6aad3 Mon Sep 17 00:00:00 2001 From: Kidhar Bachan Date: Tue, 12 Mar 2024 19:44:12 +0200 Subject: [PATCH] Refactors code to make it more readeable and efficient --- library/VTKExtensions/Rendering/vtkF3DRenderer.cxx | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/library/VTKExtensions/Rendering/vtkF3DRenderer.cxx b/library/VTKExtensions/Rendering/vtkF3DRenderer.cxx index 5baf4dd831..73f2a9fffc 100644 --- a/library/VTKExtensions/Rendering/vtkF3DRenderer.cxx +++ b/library/VTKExtensions/Rendering/vtkF3DRenderer.cxx @@ -1358,16 +1358,12 @@ void vtkF3DRenderer::SetUseOrthographicProjection(bool use) if (use) { - this->UseOrthographicProjection = use; - const double distance = std::sqrt(vtkMath::Distance2BetweenPoints(position, focal)); const double parallelScale = distance * tan(angle / 2); camera->SetParallelScale(parallelScale); } else { - this->UseOrthographicProjection = !use; - const double distance = camera->GetParallelScale() / tan(angle / 2); double direction[3]; vtkMath::Subtract(position, focal, direction); @@ -1377,6 +1373,7 @@ void vtkF3DRenderer::SetUseOrthographicProjection(bool use) vtkMath::Add(focal, direction, newPosition); camera->SetPosition(newPosition); } + this->UseOrthographicProjection = use; camera->SetParallelProjection(use); this->ResetCameraClippingRange(); }