Hi,
I use a CAD package called Rhino which lets users write python scripts that run in the cad environment. I have a closed curve that is a design surface border and I have a sparse data set of 2D surveyed points taken around that border, so some error is included in the 2D data set. I would like to know what python function I could use to do a 2D best fit of the points to the curve.
Plenty of examples of fitting curves to points but not of best fitting points to a closed curve of which I do not know the formula.
You can use a parametric spline (where X and Y are each functions of a "time" coordinate `t`) with periodic boundary conditions. See this StackOverflow answer for an example using scipy.interpolate:
Whether our spline representation can be converted to Rhino NURBS or if Rhino itself can do a periodic parametric NURBS and do the fitting itself, I don't know.
--
Robert Kern