Understand the algorithm of Ngon method in bpy.ops.mesh.quads_convert_to_tris

Hi, can someone who knows C help me understand the algorithm of Ngon method in bpy.ops.mesh.quads_convert_to_tris please?

The function calls the edit bmesh operator “triangulate” defined here. It calls bmo_triangulate_exec which calls BM_mesh_triangulate. This will just iterate over all faces and triangulate them one by one using BM_face_triangulate. It uses a simple algorithm to triangulate a quad and for n-gons it uses an ear clipping method.
Obviously that glances over a lot of details, but that’s essentially all it does.

Great! Exactly what I’m looking for, thank you.