Zoom Extents to match trace image


(Jhargrave) #1

Is there a way to ask an OpenNURBS view to zoom to extents to match the assigned ON_3dmViewTraceImage ?

Similar to the code here:

But purely using the OpenNURBS library? (eg. replicating what the RhinoDollyExtents call does in that example) and ideally a way to also account for the ON_3dmViewTraceImage assigned to the view?


(Dale Fugier) #2

Hi @jhargrave,

I’ve attached an openNURBS version of the RhinoDollyExtents C++ SDK function.

opennurbs_dollyextents.cpp (3.1 KB)

The function requires a bounding box in camera coordinates.

ON_Xform w2c;
current_vp.GetXform(ON::world_cs,ON::camera_cs,w2c);
bbox.Transform(w2c);
ON_Viewport zoomed_vp;
if (ON_DollyExtents(current_vp, bbox, zoomed_vp))
{
  //...
}

Hope this helps.

– Dale


(Jhargrave) #3

Thanks for taking the time to create that Dale. It was extremely helpful.