Polygon helper utilities for LUA, ported from the polyk js library