This shape optimizing algorithm checks all adjacent edges of a shape and substitutes any 2 edges with a single edge if angle between them is greater than MaxAngleToKeep. The algorithm makes sure there are not obtuse angles in a shape, which are very close to flat line.
The shape optimizer does not optimize shapes to less than 3 points, so optimized shape always will have at least 3 points.
For example, the below circle shape comprised of 65 points, can be optimized to 10 points by setting MaxAngleToKeep to 160.