def quads_to_triangles(mesh):
    """
    Convert Quadrilateral faces to Triangular ones.

    Inputs:
        mesh - an OBJ object loaded from load_obj()
    Outputs:
        Modifies the mesh.f and returns mesh.
    """
    newFaces = []
    for i, face in enumerate(mesh.f):
        if len(face) != 3:
            assert len(face) == 4
            newFaces.append((face[0], face[1], face[2]))
            newFaces.append((face[2], face[3], face[0]))
        else:
            newFaces.append(face)
    mesh.f = newFaces
    return mesh
