import { bt_face_triangulate } from "./face/bt_face_triangulate.js";

/**
 * Convert all non-triangular faces into triangles.
 *
 * @param {BinaryTopology} mesh
 */
export function bt_mesh_triangulate(mesh) {

    const faces = mesh.faces;

    const face_count = faces.size;

    for (let face_id = 0; face_id < face_count; face_id++) {
        if (!faces.is_allocated(face_id)) {
            continue;
        }

        bt_face_triangulate(mesh, face_id);
    }

}