scala implementation of the potrace algorithm