Today I make a minor update on my Tetrahedron modifier. Loops and faces are constructed in order to get a solid tetrahedron mesh.

In the Tetrahedron modifier, firstly a DerivedMesh with desired count of vertices, loops, and faces is allocated using CDDM_new, then vertices, loops and faces data are filled into DerivedMesh using functions CDDM_get_verts, CDDM_get_loops, and CDDM_get_polys.

This is a common approach to construct DerivedMesh from scratch. The similar method can also be seen in Remesh modifier.

You can also use BMesh tools to construct DerivedMesh in a modifier. This is usually seen in modifiers whose task is to refine parts of mesh. A typical example is Bevel modifier.

In this approach, a BMesh object has to be constructed using DM_to_bmesh, then followed by desired BMesh operations. After all operations have finished, the BMesh object gets converted to result DerivedMesh using CDDM_from_bmesh, and released using BM_mesh_free.