TITLE: Curve-fitting using circles
QUESTION [5 upvotes]: I'm working for a firm, who can only use straight lines and (parts of) circles.
Now I would like to do the following: imagine a square of size $5\times5$. I would like to expand it with $2$ in the $x$-direction and $1$ in the $y$-direction. The expected result is a rectangle of size $7\times9$. Until here, everything is OK.
Now I would like the edges to be rounded, but as the length expanding is different in $x$ and $y$ direction, the rounding should be based on ellipses, not on circles, but I don't have ellipses to my disposal, so I'll need to approximate those ellipses using circular arcs.
I've been looking on the internet for articles about this matter (searching for splines, Bézier, interpolation, ...), but I don't find anything. I have tried myself to invent my own approximation using standard curvature calculations, but I don't find a way to glue the curvature circular arcs together.
Does somebody know a way to approximate ellipses using circular arcs?
Thanks
Dominique

REPLY [2 votes]: If you want to control the error in the approximation, then biarc interpolation/approximation is what you need, as indicated in the answer from @Paul H.
A biarc curve is usually constructed from two points and two tangent vectors. This actually leaves one degree of freedom unfixed, and there are several different ways to fix this. It can be shown that the "junction" where the two arcs meet lies somewhere on a certain circle, and you can choose where. See this paper for more than you probably want to know.
To get a good approximation, you'll probably have to use several biarc curves, strung end-to-end. Start out with the end-points and end-tangents of your quarter ellipse, and construct a single biarc. Calculate 10 or 15 points along the ellipse, and measure their distance to the biarc, to estimate the approximation error. If the error is too large, compute a point and tangent at some interior location on the ellipse, and approximate with two biarcs. Rinse and repeat until you have an approximation that's satisfactory. More details in this paper.
If you just want a simple approximation, and you don't care very much about the error, then there is a technique that draftsmen have used to draw ellipses for decades, sometimes called the "four center" method. See section 5.2.0 of this document., or this web page.