Added custom polygon manipulation

Committing code before a massive trim of custom logic which will be
replaced by the Clipper library.