Refactor getClosestPointInPolygon() to reduce duplication.
Refactor getClosestPointInPolygon() to reduce duplication.

alephobjects/CuraEngine,alephobjects/CuraEngine,ROBO3D/CuraEngine,Ultimaker/CuraEngine,ROBO3D/CuraEngine,Ultimaker/CuraEngine,ROBO3D/CuraEngine,alephobjects/CuraEngine