The algorithm is based on libtess2 here and we optimizated some implementation and fixed some bugs.
The differents between our algorithm and libtess2's algorithm:
We change the coordinate system and the sweep direction (sweep line by horizontal here).
We need not project the vertices because our graphic engine is 2d,
继续阅读 »