Fitting splines to famous curves programmatically

90 Views Asked by At

this may be a bit of a naive question. I am looking for a way to input a Cartesian description of a famous curve and map that to some spline say NURBS to make spline paths. Is this at all possible?

Examples of curves in question: http://www-history.mcs.st-and.ac.uk/Curves/Curves.html

Ideally I would like to input the equation describing the curve and fit a spline over a given range

2

There are 2 best solutions below

1
On BEST ANSWER

In many cases, it won’t be possible to represent the given curve exactly in NURBS form. But you can certainly construct NURBS approximations that are as accurate as you want.

The easiest way to create an approximation is to construct a spline curve that interpolates a sequence of points lying on the given curve. So, how do you get this sequence of points? If the given curve has known parametric equations, this is easy: you just take a sequence of parameter values $t_1, t_2, \ldots$, and calculate points $P_i = \left( x(t_i), y(t_i) \right)$. If you have only an implicit equation for the given curve, then things are more difficult. This paper outlines one possible approach: https://www.sciencedirect.com/science/article/pii/S0377042703004114

1
On

In theory, as long as you can evaluate points on these curves, you can fit a spline to any range of these curves. There are tons of curve fitting techniques (interpolation vs approximation) over the internet that you can search for and therefore I won't elaborate here.

However, there is one issue you need to pay attention to: some of these famous curves have $C^1$ discontinuities (e.g., Astroid and Cardioid). If the range of curve you would like to fit a spline to contains such $C^1$ discontinuities, you need to know where these $C^1$ discontinuities occur so that they will be handled properly during curve fitting. On the other hand, depending on what your original purpose is, it will be easier for you to simply approximate the curve by a polyline and you do not need to be concerned with the $C^1$ discontinuities issue.

PS: Some curves listed in the "Famous Curve Index" page only have implicit representation (e.g., Bicorn, Cartesian Oval). It will be much harder to evaluate points on these curves and this is probably the reason that they do not show up on the "Famous Curve Applet Index" page (the page pointed to by a link in the "Famous Curve Index" page).