[vtk-developers] Bug in vtkCamera::Elevation

Xabi Riobe xabivtk at gmail.com
Fri Feb 5 05:09:14 EST 2016


Yes the fix will be for both Elevation and Pitch and i think it makes sense
for the ViewUp to be modified, but you are wright to raise the backwards
compatibility issue...

I could set the computed ViewUp before the call to SetPosition and set back
the old one after, that would fix the main problem and keep backwards
compatibility. I can be ok with that but it feels odd to me...

If no one comes with a better solution in a couple of days will push that
one.

For the warning in vtkPerspectiveTransform::SetupCamera i have second
thoughts, as VTK in general does not check stuff like that and let the
responsibility to the caller. What do you think?

2016-02-04 23:39 GMT+01:00 David Gobbi <david.gobbi at gmail.com>:

> Hi Xabi,
>
> I think it's a good fix, note that the Pitch() method probably has the
> same issue.
>
> It will break backwards compatibility, however, because currently the
> Elevation()
> method leaves the ViewUp unchanged.  So any code that calls Elevation() and
> then calls Azimuth() will give a different result after your fix.
>
> Does anyone know why the Elevation() and Pitch() methods leave the ViewUp
> unchanged?
>
>  - David
>
>
> On Thu, Feb 4, 2016 at 6: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?
>>
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtk-developers/attachments/20160205/d76bd5d4/attachment.html>


More information about the vtk-developers mailing list