[vtk-developers] Bug in vtkCamera::Elevation

Will Schroeder will.schroeder at kitware.com
Fri Feb 5 06:54:53 EST 2016


This is a known problem since 1993 when VTK was first written. It is
presumed to be an application-level issue. That is, if you are flying over
terrain, you do not want to be messing with the view up, otherwise the
elevation, pitch, etc. lose their meaning.

As evidence of this check out
VTK/Interaction/Style/vtkInteractionStyleTerrain which has explicit
commentary about dealing with the north pole singularity. Then look at
vtkInteractorStyleTrackballCamera, vtkInteractorStyleJoystickCamera, etc.
They all have explicit calls to camera->OrthogonalizeViewUp() which is
added to address the view up singularity.

Best,
W

On Thu, Feb 4, 2016 at 8:54 AM, Xabi Riobe <xabivtk at gmail.com> wrote:

> Hi,
>
> There is an issue in vtkCamera::Elevation if the angle is 90.
>
> It is 100% reproductible with VS2013 if compiled in 64bits, otherwise the
> rounding epsilon makes it work by chance.
>
> I'm willing to fix it in GitLab but first i would like your opinion about
> the best way to do it.
>
> with a simple example of a plane in a renderer, and a call to
> renderer->GetActiveCamera()->Elevation(90)
>
> What happens in the call stack of vtkCamera::Elevation :
>    vtkCamera::SetPosition()
>    vtkCamera::ComputeViewTransform
>    vtkPerspectiveTransform::SetupCamera
>
>    vtkMath::Cross(viewUp,viewPlaneNormal,viewSideways);
>
> where viewUp and viewPlaneNormal are both (0,1,0)  so viewSideways is
> (0,0,0) leading to bad camera parameters.
> Here comes the VS13+64bits configuration case, when with others,
> viewSideways is luckily different than 0
>
> What do you think of applying the rotation to the viewUp vector in
> vtkCamera::Elevation before the call to SetPosition?
> Should we put a warning in vtkPerspectiveTransform::SetupCamera
> when vtkMath::Normalize returns 0?
>
>
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Search the list archives at: http://markmail.org/search/?q=vtk-developers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtk-developers
>
>
>


-- 
William J. Schroeder, PhD
Kitware, Inc. - Building the World's Technical Computing Software
28 Corporate Drive
Clifton Park, NY 12065
will.schroeder at kitware.com
http://www.kitware.com
(518) 881-4902
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160205/c735ca1b/attachment.html>


More information about the vtk-developers mailing list