adjusting zoom speed

Hey all,

In my display() I calculate the time it takes do draw a frame since the last frame and multiply that by some really small value like 0.0001. Then I add that to the current zoomFactor value and run an Animator when the user presses a zoom key.

I then use this zoomFactor value in a glOrtho() call and multiply it by the left, right, bottom and top values to zoom my model in and out. The entire purpose for doing this is that it zooms my model very smoothly which some of you helped me with.

My problem is that when the model is far away, it zooms slow enough to be under user control, but as it gets nearer (larger) it moves faster and is very hard to adjust and stop at the exact size I want the model to be. It’s like watching the Enterprise go into warp speed as near distances and move slowly when it’s far away.

Anyone have any ideas how to fix this?

If you have a single model you want to zoom, you could calculate the distance from the model and adjust the zoom-factor accordingly. Maybe just something like

zoomfactor=minzoomfactor*distance

This of course is a quite “rough” adjustment, just as an example. It might be more appropriate to project the size gain you want to archieve on the screen to the model by using the intercept theorems.

You might end up with something like:


modelZoom/screenZoom=(distanceScreenModel+distanceViewerScreen)/distanceViewerScreen
  =>
modelZoom/screenZoom=distanceScreenModel/distanceViewerScreen+1
  =>
modelZoom=(distanceScreenModel/distanceViewerScreen+1)*screenZoom

where modelZoom is the zoomfactor you can feed to you existing zoom routine, screenZoom is the amount your model should grow on screen, distanceViewerScreen is the virtual distance a user might sit in front of the screen and distanceScreenModel is - well - I bet you can figure this out :wink: