First iteration of polygon triangulation via the ear clipping algorithm is working now. It's not optimal yet though. I had to implement a circular doubly linked list because the algorithm requires that.

This is the learning material I used to implement it: https://www.geometrictools.com/Documentation/TriangulationByEarClipping.pdf