Refactored common code into the PolyTools static class.
 - don't know yet if I introduced some bugs (demo is working for now)
 - maybe it's worth to split it further into a PointTools class (with Vec2 classic operations - we'll see)