The Wikipedia articles for Reuleaux triangle and curve of constant width do a good job of describing the properties of a Reuleaux polygon, but they don't give a straightforward formula for computing or drawing such a figure, except in terms of the manual compass-and-straightedge construction.
Is there a formula or algorithm that, given the number of sides and the width/diameter, would give some data representation of a Reuleaux polygon that could be used to recreate it programmatically?
In particular, I'm looking for the coordinates of the vertices (or the angle/direction from one vertex to another) and the details of the arc connecting them.
Best Answer
I derived a parametric formula for Reuleaux polygons some time ago in this blog entry.
To make this post self-contained, here are the equations:
$$\begin{align*} x&=2\cos\frac{\pi}{2n}\cos\left(\frac12\left(t+\frac{\pi}{n}\left(2\left\lfloor\frac{n t}{2\pi}\right\rfloor+1\right)\right)\right)-\cos\left(\frac{\pi}{n}\left(2\left\lfloor\frac{n t}{2\pi}\right\rfloor+1\right)\right)\\ y&=2\cos\frac{\pi}{2n}\sin\left(\frac12\left(t+\frac{\pi}{n}\left(2\left\lfloor\frac{n t}{2\pi}\right\rfloor+1\right)\right)\right)-\sin\left(\frac{\pi}{n}\left(2\left\lfloor\frac{n t}{2\pi}\right\rfloor+1\right)\right) \end{align*}$$
Here is a Mathematica demonstration:
(Note the use of the complex form of the parametric equations.)
For some applications, a polar equation (like the one in this answer) might be more convenient. One can use the usual distance formula in polar coordinates to derive the polar equation of an $n$-sided Reuleaux polygon:
$$r=\cos\left(\theta -\frac{2\pi}{n}\left\lfloor\frac{n (\theta -\pi )}{2 \pi }+\frac{1}{2}\right\rfloor\right)+\sqrt{1+2\cos\frac{\pi}{n}+\cos^2\left(\theta -\frac{2\pi}{n}\left\lfloor\frac{n (\theta -\pi)}{2 \pi}+\frac{1}{2}\right\rfloor\right)}$$
In Mathematica, one can do this:
to get a picture identical to the one above.