MantisBT - VTK
View Issue Details
0009740VTK(No Category)public2009-10-20 08:582016-08-12 09:55
edice 
Kitware Robot 
normalminoralways
closedmoved 
 
 
0009740: vtkInteractorStyleTerrain generates errors "Resetting view-up since view plane normal is parallel"
When you look down the "north pole" with the Terrain interactor style, you get a lot of warning messages like so:

Warning: In /opt/vtk_5_4_2/VTK/Rendering/vtkRenderer.cxx, line 1051
vtkOpenGLRenderer (0x9dff598): Resetting view-up since view plane normal is parallel



In vtkRenderer.cxx, there is this test:
  vup = this->ActiveCamera->GetViewUp();
  if ( fabs(vtkMath::Dot(vup,vn)) > 0.999 )
    {
    vtkWarningMacro(<<"Resetting view-up since view plane normal is parallel");
    this->ActiveCamera->SetViewUp(-vup[2], vup[0], vup[1]);
    }

So, vtkRenderer.cxx starts to panic when the dot > 0.999, which I will show happens before the Terrain's limit of 179 degrees.





There is code in vtkInteractorStyleTerrain that, quote:

  // Move the camera.
  // Make sure that we don't hit the north pole singularity.

but, it does not do the job well enough.
This is the code that avoids the singularity:

  double angle = vtkMath::DegreesFromRadians( acos(vtkMath::Dot( dop, vup) ) );
  if ( ( angle + e ) > 179.0 ||
       ( angle + e ) < 1.0 )
    {
    e = 0.0;
    }

I added some printouts after this code:
    cout << "dot " << fabs(vtkMath::Dot( dop, vup)) << " angle+e = " << angle << " + " << e << " = " << angle+e << endl;

Note, the dot represents the past, angle+e represents the future.


I saw these messages as i rotated towards the north pole:

dot 0.997361 angle+e = 175.836 + 0.640569 = 176.477
dot 0.99811 angle+e = 176.477 + 0.640569 = 177.117
dot 0.998735 angle+e = 177.117 + 0.640569 = 177.758
Warning: In /opt/vtk_5_4_2/VTK/Rendering/vtkRenderer.cxx, line 1051
vtkOpenGLRenderer (0x9dff598): Resetting view-up since view plane normal is parallel
dot 0.999235 angle+e = 177.758 + 0.640569 = 178.399

So, dot=0.999234 after 0.640569 was added to 177.117 to get angle=178.399

We have not reached 179 degrees and we have surpassed dot=0.999234.



So the solution appears to be either change vtkRenderer.cxx's limit to 0.9999 or high (keep adding 9's), OR to change the Terrain's test to 2 and 178 degrees.

No tags attached.
Issue History
2009-10-20 08:58ediceNew Issue
2009-10-20 09:11ediceNote Added: 0018123
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:55Kitware RobotNote Added: 0037110
2016-08-12 09:55Kitware RobotStatusexpired => closed
2016-08-12 09:55Kitware RobotResolutionopen => moved
2016-08-12 09:55Kitware RobotAssigned To => Kitware Robot

Notes
(0018123)
edice   
2009-10-20 09:11   
If Terrain's test is changed, then 2 and 178 (as prev stated) isn't enough.

3 and 177 degrees appears to be enough. Someone with a calculator could probably work out the exact limits.
(0037110)
Kitware Robot   
2016-08-12 09:55   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.