Curve stitching is the art of creating smooth curves from straight lines. All you need is a pen and a ruler, or two sticks and some pieces of string, or just anything that gives you straight lines and some structure to keep them in place. Here is an example.

There are a lot of nice examples and tutorials for this technique on the internet (see here, here, and here), but I couldn't find a mathematical description of the curve. So I just set up some equations myself.

I'm only looking at the case where we connect points on two line segments of equal length that originate in the same point.
(In the figure above, we have three such cases that together form an equilateral triangle.)
The angle between those two line segments is arbitrary.
We mark the same number of equally-spaced ticks on both of them.
Then we connect the *i*th tick on the left line segment with the *i*th tick on the right line segment *et voilà*.

Let's draw a simple example with only a few lines to better see what's going on.

For convenience, I let the initial line segments originate at (0, 0) and make the *y*-axis the axis of symmetry between both of them.
An important observation is that the intersection points of adjacent lines seem to form a curve.
Let the vectors \(\bm{a_1}\) and \(\bm{b_n}\) represent the points \(A_1 = (-c, s)\) and \(B_n = (c, s)\), then we can describe the other four points in the diagram as scaled versions of these two
$$
\begin{align*}
\bm{a_i} &= (p + d) \cdot \bm{a_1}\\
\bm{a_j} &= p \cdot \bm{a_1}\\
\bm{b_i} &= (1-p) \cdot \bm{b_n}\\
\bm{b_j} &= (1-p+d) \cdot \bm{b_n}\\
\end{align*}
$$

where \(j = i + 1\), \(i\) is a natural number between \(1\) and \(n\) (inclusive), \(p = \frac{i}{n}\) and \(d = \frac{1}{n}\).

With these points, I set up two line equations: one through \(A_i\) and \(B_i\) and another through \(A_j\) and \(B_j\).
Since we're looking for the intersection points, the *y*-values of both equations should match, so take the equality between both line equations.
I'd like to describe the intersections in terms of \(x\) and get rid of \(p\), so we solve the new equation for \(p\).
The equation is quite long if you write it out in terms of \(p\), \(d\), \(c\), \(s\), and my handwriting is too sloppy to ensure correctness, so I let SymPy do the work for me.
$$
p = \frac{c - x}{2 c}
$$

Substitute \(p\) back into one of the line equations to get the function of the curve on which the intersection points lie. The function is quadratic and thus the curve is a parabola. $$ f(x) = \frac{s \left(2 c^{2} d + c^{2} + x^{2}\right)}{2 c^{2} \left(d + 1\right)} $$

The positions of the red circles in the following diagram are computed with this function.
As you can see, if you plug in the matching *x*-values, the circles are drawn exactly around the intersection points.

The curve is changing slightly with the number of lines.
If the number of lines approaches infinity, \(d\) approaches \(0\), and we have the following quadratic function.
$$
f(x) = \frac{s \left(c^{2} + x^{2}\right)}{2 c^{2}} = \frac{s}{2c^2} x^2 + \frac{s}{2}
$$
If you didn't fall asleep yet and want to know how to derive this construction in the first place, check out **part two**.