Calculating field of view



In RhinoCommon there is a nice function to calculate the fov for a perspective view (GetCameraAngle()). It is possible to use this function to determine the fov for a parallel view? As you zoom in/out of a parallel view, the GetCameraAngle fov changes, but not as the perspective window does - looks like I need to adjust it by another factor.

EDIT: The is a description of doing this (with Rhino4?) here… however there appears to be no ViewRadius method in RhinoCommon.

Thanks in advance.


(Steve Baer) #2

Hi Paul,
Here’s the ViewRadius function implemented in python

In C# / RhinoCommon, this would be

RhinoViewport viewport = ...
if (viewport.IsParallelProjection)
  double left, right, bottom, top, near, far;
  if( viewport.GetFrustum(out left, out right, out bottom, out top, out near, out far) )
    double viewradius = top<right ? top : right;