#ifndef __MESH_OPERATIONS__
#define __MESH_OPERATIONS__

// ========================================================================== //
// External libraries
namespace HMesh {
    class Manifold;
}

// ========================================================================== //
// Mesh cleanup and improvement functions

/** Collection of usefull utilities.
 *
 * A number of utilities, usefull for debugging, mathematics and other areas.
 */
namespace Utilities {
    /** Function designed to remove small unconnected components from a mesh.
     *
     * @param m
     * @param comp_size_thresh
     * @return int
     */
    int remove_small_components(HMesh::Manifold &m, int comp_size_thresh = 100);

    /** Function designed to keep only the largest component
     *
     * @param m
     * @return int
     */
    int keep_largest_component(HMesh::Manifold &m);

    /** Boundary smoothing
     *
     * This function will smooth the boundary by adding triangles when the edge
     * of the mesh is jagged. Set the angle threshold to define how big an angle
     * we try to patch up.
     *
     * @param m
     * @param angle_threshold
     * @param maxiter
     */
    void smooth_boundary(HMesh::Manifold &m, double angle_threshold = 3.1,
                         int maxiter = 1e3);
} // namespace Utilities

#endif /* __MESH_OPERATIONS__ */