Almost complete implementation of the polygonal curve algorithm.
I still need to make it less parametric and remove the last 6 parameters and use the gradient descent as opposed to a linear search.