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-
- 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
- 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?