Use boost::geometry (if available) to properly clip facets on the image boundary, rather than pushing vertices.
boost::geometry