The first thing is to write a function to draw a bezier curve. I could have used lines, but I feel bezier curves look nicer.

I use a very simple algorithm, which can be visualized with this animation:

https://en.wikipedia.org/wiki/De_Casteljau%27s_algorithm https://pomax.github.io/bezierjs/ http://pomax.github.io/bezierinfo/ http://microbians.com/?page=math&id=math-quadraticbezieroffseting http://www.scratchapixel.com/lessons/advanced-rendering/bezier-curve-rendering-utah-teapot