PolyTools: added conversion to/from flat array and changed to use distanceSquared in segmentIntersect