Removes bounce at edge of polygons

fixes #1223

turns out what was happening was at thin parts the polyline wasnt being treated as such so it was moving the maximum height of the polyline