Math behind 'Zoom Extend'

Hi,
can someone tell me how ‘zoom extend’ works.
I can use the selected object location for the view location (window).
I can use the selected object rotation for the view location.
But how can i zoom in till the selected object fits the window (orthographic view)?

Any tip is welcome

Are you looking for ZoomSelected?

yes , but not the command instead the vector/matrix math behind it.

McNeel rarely if ever provides details of the math used in Rhino beyond the basics of NURBS and related.

Hi @flokart,

Here is come C++ code I posted a while back.

– Dale