# First steps towards CAD standard curve fitting

I am interested in building a program to accomodate the following workflow:

A user begins with an arbitrary vector/CAD shape, which they wish to transfer onto paper without using a printer (there are both realistic and novelty reasons why this problem is interesting to me). The program will accept this file and create a list of instructions to draft the shape using ruler, square, compass, and standard curve forms. I am not currently concerned with the details of this program (file formats, types of vector curve [spline, bezier, etc], output formatting, etc) but with the core geometric description problem. I think it is fairly straightforward to accomplish this with straight lines, angles, and offsets.

However, I am not sure how to approach the problem of curve fitting. Ideally, the user would be able to have curves in the cad file fit (probably approximated) so that they may draft them using standard French curve forms, including:

Hip Curve

Vary form curve

Assume that these curves are made to standard shapes and sizes and are modeled with dimensional accuracy. Furthermore, they are ruled at specific points and a user can place them on the paper diagram at specific positions and angles (relative to the other elements in the diagram that have already been drafted).

What would be the first steps towards solving this problem? Are there existant computational geometry methods for approximating curves with (segments and combinations of) standard forms? What literature would I want to read? I apologize for the somewhat open-ended nature of this question, but it's difficult for me to determine where to begin.

If it's helpful, the CAD patterns are probably such that the curves can, in fact, be very closely approximated with just one or two of these shapes - the primary use would be for fashion pattern drafting, and these French curves are specifically designed for creating the geometry of flat patterns that fit a human body.

• As I understand it, this is the math used for the "french curve form" en.wikipedia.org/wiki/Euler_spiral I guess you would start by understanding that, an apply curve-fitting to that type of functions. How easy it is to learn curve-fitting depends on your math background. But the literature should be easy to find. Feb 28, 2017 at 7:25
• @remi000 So the method you are recommending would be similar to regression/statistical curve fitting (maybe with a more appropriate distance/error function than those typically used in statistics), and simply using Euler spiral/French curve functions as the function being fit? Feb 28, 2017 at 16:44
• Yes something like that. I remember there is some very general method for curve fitting. And you can use this method on any kind of curve after defining the curve-parameters of which can vary (web.iitd.ac.in/~pmvs/courses/mel705/curvefitting.pdf) I've never used one of these French or Hip curves, but I guess you need to move it around to draw the exact curve you want, so this would be multiple segments like you said.. This might make it more complex. Anyway, this sounds like an interesting problem! Mar 1, 2017 at 7:33
• Just so you know, the Bezier curve was created so that designers didn't have to deal with French curves anymore since they are imprecise and the resulting curves are hard to communicate between people. Also, if you are looking to fit data points with a polynomial, you should check out least squares fitting, which is an O(1) operation - no looping or gradient descent type stuff required. One other thing, bezier curves can be approximated with line art, like with strings. Check out figure 2 here: plus.maths.org/content/bridges-string-art-and-bezier-curves Mar 2, 2017 at 6:06

Since you have a limited set of tools you are not actually doing a classical fitting. What you have is a discrete problem. And since you are looking for a somewhat easily drawn fit, no more than twice segmented for example.

One way to approach this is to find all the points that match your curvature requirements. Then find the point x units away from point on both ends for all of these and see how well it matches. If the curvature match at the endpoint is too much off then this isn't a good candidate. If you don't find a good candidate split the problem into two. Once you have found a goodish candidate slide the result to see if relaxing the thing makes the error more symmetric.

Some things to note. Since your french curve is accelerating from one end to another you need to split beziers and b-splines at each span where the curve changes direction. Also once you've found good endpoints be sure to check that the halfway isn't too much off.

Now if you want to do a classical fitting like approach then you need to parametrize the sliding and scale of your curve. This is not likely useful since you in fact can not scale your rules at whim.

Or then you could just get a spline, you know one of those things that were used before computers and stuff, and write instructions on how to set up the spline.

• Thank you, this is very helpful and gives me a lot of jumping-off points. I considered splines, but they aren't typically used in this drafting context AFAIK, so I don't think they would be ideal for at least some of the applications. Mar 3, 2017 at 16:13
• @WillGoldie POmax has added a section on his fabulous bezier curve page that actually adresses how to simplify beziers as arcs which might be of use for you: pomax.github.io/bezierinfo/#arcapproximation Mar 20, 2017 at 11:44

As far as I know, there are no standard shapes for (physical) French curves. The folks who manufacture them are free to choose any shapes they like. Of course, they choose shapes that look "nice", which typically means curvature that's either monotonely increasing or has a single peak value.

So, you can't solve this problem unless you make some assumptions about the specific shapes of French curves available to your user(s).

Once you have done this, you can model the shape of the French curve as a Bezier curve (for example). Then the problem is to position/orient this Bezier curve so that it fits the data, which is a simple least-squares fitting problem. I'll provide more details if you confirm that this approach is promising.