Here's a parametric equation I have made for a regular $n$-gon, coded in R:

 n=5;
 theta=(0:999)/1000;
 r=cos(pi/n)/cos(2*pi*(n*theta)%%1/n-pi/n);
 plot(r*cos(2*pi*theta),r*sin(2*pi*theta),asp=1,xlab="X",ylab="Y",
 main=paste("Regular ",n,"-gon",sep=""));

And picture:

![5-gon][1]

The formula I used is 

$$\displaystyle r=\frac{\cos\left(\frac{\pi}{n}\right)}{\cos\left(\left(\theta \mod \frac{2\pi}{n}\right) -\frac{\pi}{n}\right)} \; .$$

So, using polar plots and the modulo function, it's pretty easy to make regular n-gons.

 [1]: https://i.sstatic.net/bUhKk.png