Pintograph (revisited) - pretty patterns with mathematics

Geometric patterns are fun. In this post, I’m going to showcase a particular method of generating such patterns, named pintograph as coined by the daughter of Fran McConville. It is, at its simplest, two rods connected at one end to draw a line with a pen, and other ends connected to rotating circles. However, its mathematical definition is a bit more involved, yet required for simulating it accurately on a computer…


In the event you have read a prior version of this post, you are correct noticing that the theory has been notably simplified. Other remastering has been done as well

Before we begin, we will make a couple of assumptions:

Calculating Pr1P_{r1}, Pr2P_{r2}

First, we need to derive the exact coordinates of Pr1x,yP_{r1_{x,y}} and Pr2x,yP_{r2_{x,y}}

Pr1=P1+(r1cos(t1),r1sin(t1))Pr1=(r1cos(t1),r1sin(t1))P1=(0,0)\begin{align*} P_{r1} &= P_{1} + (r_{1} * \cos(t_{1}), r_{1} * \sin(t_{1})) & \\ P_{r1} &= (r_{1} * \cos(t_{1}), r_{1} * \sin(t_{1})) &P_{1} = (0,0) \end{align*}


Pr2=P2+(r2cos(t2),r2sin(t2))Pr2=(dcircle+r2cos(t2),r2sin(t2))P2=(dcircle,0)\begin{align*} P_{r2} &= P_{2} + (r_{2} * \cos(t_{2}), r_{2} * \sin(t_{2})) & \\ P_{r2} &= (d_{circle} + r_{2} * \cos(t_{2}), r_{2} * \sin(t_{2})) &P_{2} = (d_{circle},0) \end{align*}


Determining hpenh_{pen}

First, we’ll determine Pr1Pr2\overrightarrow{P_{r1}P_{r2}}:

Pr1Pr2=Pr2Pr1Pr1Pr2=(dcircle+r2cos(t2),r2sin(t2))(r1cos(t1),r1sin(t1))substitutionPr1Pr2=(dcircle+r2cos(t2)r1cos(t1),r2sin(t2)r1sin(t1))\begin{align*} \overrightarrow{P_{r1}P_{r2}} &= P_{r2} - P_{r1} & \\ \overrightarrow{P_{r1}P_{r2}} &= (d_{circle} + r_{2} * \cos(t_{2}), r_{2} * \sin(t_{2})) - (r_{1} * \cos(t_{1}), r_{1} * \sin(t_{1})) & \text{substitution} \\ \overrightarrow{P_{r1}P_{r2}} &= (d_{circle} + r_{2} * \cos(t_{2}) - r_{1} * \cos(t_{1}), r_{2} * \sin(t_{2}) - r_{1} * \sin(t_{1})) & \\ \end{align*}

and magnitude for it

Pr1Pr2=(dcircle+r2cos(t2)r1cos(t1))2+(r2sin(t2)r1sin(t1))2|\overrightarrow{P_{r1}P_{r2}}| = \sqrt{(d_{circle} + r_{2} * \cos(t_{2}) - r_{1} * \cos(t_{1}))^{2}+(r_{2} * \sin(t_{2}) - r_{1} * \sin(t_{1}))^{2}}

Knowing1 h=b214a2h = \sqrt{b^{2}-\frac{1}{4}a^{2}} for isosceles triangles, we come to the conclusion:

hpen=(Pr1Ppen)214(Pr1Pr2)2h_{pen} = \sqrt{(|\overline{P_{r1}P_{pen}}|)^{2} - \frac{1}{4}(|\overrightarrow{P_{r1}P_{r2}}|)^{2}}

The equation would be far too long if written fully, so it will be omitted. Geometrically the result does make sense though - as sides are of constant length, longer distance between points on circles means smaller height.

Determining ppenp_{pen}

Midpoint of Pr1Pr2\overrightarrow{P_{r1}P_{r2}}

Let midpoint be pmidp_{mid}

pmid=pr1+pr22pmid=(r1cos(t1),r1sin(t1))+(dcircle+r2cos(t2),r2sin(t2))2substitutionpmid=(r1cos(t1)+dcircle+r2cos(t2)2,r1sin(t1)+r2sin(t2)2)\begin{align*} p_{mid} &= \frac{p_{r1}+p_{r2}}{2} & \\ p_{mid} &= \frac{(r_{1} * \cos(t_{1}), r_{1} * \sin(t_{1}))+(d_{circle} + r_{2} * \cos(t_{2}), r_{2} * \sin(t_{2}))}{2} & \text{substitution} \\ p_{mid} &= (\frac{r_{1} * \cos(t_{1}) + d_{circle} + r_{2} * \cos(t_{2})}{2}, \frac{r_{1} * \sin(t_{1}) + r_{2} * \sin(t_{2})}{2}) \\ \end{align*}

Deriving ppenp_{pen}

We now have sufficient information for the final equation:

ppen=pmid+hpenPr1Pr2^\begin{align*} p_{pen} &= p_{mid} + h_{pen} * \hat{\overrightarrow{P_{r1}P_{r2}}}^{\perp} \\ \end{align*}

Knowing2 rotation by 90 degrees counter-clockwise is (x,y)(y,x)(x,y) \rightarrow{} (-y, x) and that V^=VV\hat{V} = \frac{V}{\\|V\\|}, deriving Pr1Pr2^\hat{\overrightarrow{P_{r1}P_{r2}}}^{\perp} is quite straightforward. It will be omitted for brevity.


For convenience and demonstrating what you should be able to do with the given equations, here is an interactive model of a pintograph. Tinker with the settings and see what you achieve

For example, what happens if you have circles of same size, but different rotation speed? Same speed but different sizes? Or, same speed and sizes, but different directions? What happens when you adjust them whilst the plotter is drawing?

Set settings below, and press Start to start a rendering process. Press Stop to stop it; Reset will clear the canvas. D is fixed at 8, rods at 15 each

Further reading