Hi
Is there are C++ methods like C# MergeColinearSegments and Smooth on polyline?
Thanx
Filip
Hi
Is there are C++ methods like C# MergeColinearSegments and Smooth on polyline?
Thanx
Filip
Hi,
I’m not really familiar with the C++ API, but in openNURBS, there isn’t one like Rhino.Geometry.Polyline.MergeColinearSegments()
from RhinoCommon.
However, this should be pretty easy to implement yourself!
You should get away with simply testing whether the two consecutive line segments are parallel, and if so get rid of their shared vertex.
However, if you want to merge with a tolerance instead, you could measure the vector angle between two consecutive segments. If the angle < tolerance the line segments would be co-linear, and their shared vertex thus culled.
Hi @Filip,
Rhino’s Convert
command uses the RhinoSimplifyCurve()
C++ SDK function. See rhinoSdkUtilities.h for the function declaration.
Rhino’s Smooth
command uses the RhinoSmoothCurve()
SDK function, Again, see rhinoSdkUtilities.h for the function declaration.
– Dale