ravi.joshi53's picture

Implementing "Fit to view" functionality in OpenTK

Hi,

I am trying to implement "Fit to view" functionality in my OpenTK application, which renders models similar to CAD software. It consist of primitive shapes (each has a separate class). Also it is having Zoom In/Out and Pan features. it uses perspective projection for better 3D effects. I can think of following two approaches to implement it-

  1. First check the current dimensions of the model then perform the zoom operation and translate the model such that it look in the middle of the view
  2. First check the current dimensions of the model then calculate the zoom factor and move the camera into appropriate location

At present, I haven't started working in any approach. I wanted to know that does there exist any better way to do the same?

Suggestion please...

Thanks