On Thu, Jan 20, 2022 at 1:15 PM <roger.dav...@geo-spatial.co.uk> wrote:

> 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:

https://stackoverflow.com/a/31466013/163633

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
_______________________________________________
NumPy-Discussion mailing list -- numpy-discussion@python.org
To unsubscribe send an email to numpy-discussion-le...@python.org
https://mail.python.org/mailman3/lists/numpy-discussion.python.org/
Member address: arch...@mail-archive.com

Reply via email to