[vtk-developers] vtkCamera and 0.0002

Ken Martin ken.martin at kitware.com
Wed Feb 25 08:37:56 EST 2004


> vtkCamera enforces the policy that the distance between the camera
> position and the focal point always be >= 0.0002.  Besides the fact
> that having them be the same would be a bad thing, is there any other
> justification for this?  The problem I'm seeing is that my entire scene
> might fit in a sphere of radius 0.0001 which would make dollying the
> camera useless.

There needs to be a limit but there is nothing magical about .0002, it was
probably something that has been in there since day 1. Having said that,
probably a safe limit would be more like 1e-10 (rough cube of a float) as
opposed to 2e-4. While VTK's calcs are in double I seem to remember having
some problems with some OpenGL variants not dealing well with camera
operations in the 1e-15 range. 

> I was wondering if this should be something that the user could set
> since he/she would know the scale of the scene being looked at.
> 
> Also, when this limit is violated the behavior is to move the focal
> point so the distance is 0.0002, perhaps a better thing to do is
> nothing - don't change the camera at all and perhaps in debug mode put
> out message stating that happened.

Doing nothing would leave the camera in an inappropriate state. Something
must change. One point where this code is called is when the position is
set. If they set the position to the focal point then we should adjust one
of the two values to avoid FPEs or worse a video driver crash for poorly
written OpenGL drivers. You could argue that the Pos should change instead
of the FP but either way someone might be unhappy. I think the key for your
case is to have a more reasonable lower limit on the distance.

Thanks
Ken





More information about the vtk-developers mailing list