Polyline to arc with C++

Hello :slightly_smiling_face:
I am using “C/C++ SDK for Rhino for Windows plugins”.
I need to convert ON_PolyLine to ON_Arc. Asking for help.
I found TryGetArc() method in “Rhino.Geometry” but of course I can’t use it.
Thanks in advance!

Of course a polyline is only an approximation of an arc. So what I would do is to define the arc based on three points: the start and end point of the polyline and one other point somewhere in the middle of the polyline. I’m sure there is a constructor for an ON_Arc that takes three points?

1 Like

Thanks for response

Hi @zer41k

RhinoCommon’s Curve.TryGetArc only returns an arc if 1.) the curve is an arc curve or 2.) the curve is a NURBS curve that has the properties of an arc.

In C++, the equivalent is ON_Curve::IsArc.

As @menno mentioned, if you have a polyline that is close to looking like an arc, just use three points of it and create an ON_Arc.

– Dale

1 Like