This reply might be too late for the original poster; nonetheless might help later readers.
I needed (well, wanted) an Archimedean spiral, that is, a spiral in which radius is a fixed multiple of angle. It ‘needed’ to be pixel-precise, but also light, that is, not made of needlessly many pieces.
Of course it could be done with many small lineto’s. But that would not be light, and also, just yuck!.
So, curveto’s. Within the PostScript at
is a command ArchimedeanSpiralPath.
It uses Bézier cubics that look like a part of a spiral (at most 45° of it). A Bézier cubic is specified by eight parameters. Naturally, it must go through the endpoints of the spiral fragment — consuming four parameters. At the start and end the slopes must be precisely tangent to the spiral — two more parameters. And, the cute extra two conditions: at each end the curvature of the Bézier must precisely match the curvature of the spiral.
So ArchimedeanSpiralPath calls ApproximatingCurve, which generates these fragments. Consider plotting a function parameterised as x(a), y(a). ApproximatingCurve takes, for the two end points, the values, single derivatives (wrt a) and double-derivatives, and returns the middle two control points of a curveto satisfying the location-slope-curvature conditions. It is a usefully general-purpose function.
ApproximatingCurve needs to solve several quartic equations. Solving high-order polynomials should be illegal in PostScript, but luckily isn’t, so is done with the function PolynomialRoots, called by ApproximatingCurve.
All of these are necessary, and also a few small pieces indicated in the comments.
ArchimedeanSpiralPath chooses close-ish angle separations for the innermost 180°, including √2 radians ≈ 81.028°, being the point at which curvature is maximal. Beyond 180° it uses multiples of 45°, for which the ApproximatingCurve is very very close.
Share and enjoy.