Optimize Polygon triangulation

For #2074.

I still want to look at the performance, but the code can be reviewed. You might want to look at the individual commits before and after the fourth one; I moved all of the functions around so they were defined before they were called.

@pjcozzi This doesn't change the subdivision as we discussed. If its better than how its done now, it'll be in a separate PR.
Add to CHANGES.md.  Once we know the performance gain, we should also mention it.