Rev 504 | Rev 512 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
/*
* Written by Christian Thode Larsen 2009-2010
* Contact: thode2d@gmail.com
* Based on original work by J. Andreas Baerentzen
* Inspired by OpenMesh (www.openmesh.org)
*/
#ifndef __HMESH_MESH_OPTIMIZATION_H
#define __HMESH_MESH_OPTIMIZATION_H
#include "Manifold.h"
namespace HMesh
{
// forward declarations
//class Manifold;
//class HalfEdgeID;
/// This class represents the energy of an edge. It is used in optimization schemes where edges are swapped (aka flipped). */
class EnergyFun
{
public:
virtual double delta_energy(const Manifold& m, HalfEdgeID h) const = 0;
virtual double energy(const Manifold& m, HalfEdgeID h) const {return 0;}
};
/// Optimize in a greedy fashion.
void priority_queue_optimization(Manifold& m, const EnergyFun& efun);
/// Optimize with simulated annealing. Avoids getting trapped in local minima
void simulated_annealing_optimization(Manifold& m, const EnergyFun& efun, int max_iter=10000);
/// Minimize the angle between adjacent triangles. Almost the same as mean curvature minimization
void minimize_dihedral_angle(Manifold& m, int max_iter=10000, bool anneal=false, bool alpha=false, double gamma=4.0);
/// Minimizes mean curvature. This is really the same as dihedral angle optimization except that we weight by edge length
void minimize_curvature(Manifold& m, bool anneal=false);
/// Minimizes gaussian curvature. Probably less useful than mean curvature.
void minimize_gauss_curvature(Manifold& m, bool anneal=false);
/// Maximizes the minimum angle of triangles. Makes the mesh more Delaunay.
void maximize_min_angle(Manifold& m, float thresh, bool anneal=false);
/// Tries to achieve valence 6 internally and 4 along edges.
void optimize_valency(Manifold& m, bool anneal=false);
/// Make radom flips. Useful for generating synthetic test cases.
void randomize_mesh(Manifold& m, int max_iter);
}
#endif