fit_curve_fail.3dm (32.5 KB)
When I run the code below on the curve in the document attached, the resulting curve has 1 control point on the origin, resulting in a very bad curve shape locally.
var res = RhinoGet.GetOneObject("Curve to fit", false, ObjectType.Curve, out var cRef);
if (res != Result.Success)
return res;
Curve toFit = cRef.Curve();
double fitTolerance = 1e-8;
var smoothed = toFit.Fit(3, fitTolerance, 0.0);
doc.Objects.AddCurve(smoothed);
Yes, I noticed that as well. Still, the strict tolerance gives this weird result, so I thought I would let you know. I suspect it has something to do with the curve being a polycurve and the fitting routine requiring lots of samples to get the required accuracy.
Hi @dale, i see _FitCrv doing this with polycurves often, even with moderate tolerances. Below is an example which deviates 3mm when fitted with a tolerance of 0.1mm.