Subversion Repositories gelsvn

Rev

Rev 182 | Rev 448 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 182 Rev 362
Line 3... Line 3...
3
 
3
 
4
#include "HMesh/Manifold.h"
4
#include "HMesh/Manifold.h"
5
 
5
 
6
namespace HMesh
6
namespace HMesh
7
{
7
{
-
 
8
	/** This class represents the energy of an edge. It is used in optimization 
-
 
9
	schemes where edges are swapped (aka flipped). */
8
  class EnergyFun
10
  class EnergyFun
9
  {
11
  {
10
  public:
12
  public:
11
    virtual double delta_energy(HMesh::HalfEdgeIter) const = 0;
13
    virtual double delta_energy(HMesh::HalfEdgeIter) const = 0;
12
    virtual double energy(HMesh::HalfEdgeIter) const {return 0;}
14
    virtual double energy(HMesh::HalfEdgeIter) const {return 0;}
13
  };
15
  };
14
 
16
 
-
 
17
	/// Optimize in a greedy fashion.
15
  void priority_queue_optimization(HMesh::Manifold& m, const EnergyFun& efun);
18
  void priority_queue_optimization(HMesh::Manifold& m, const EnergyFun& efun);
16
 
-
 
-
 
19
	/// Optimize with simulated annealing. Avoids getting trapped in local minima
17
  void simulated_annealing_optimization(HMesh::Manifold& m, 
20
  void simulated_annealing_optimization(HMesh::Manifold& m, 
18
					const EnergyFun& efun,
21
					const EnergyFun& efun,
19
					int max_iter=10000);
22
					int max_iter=10000);
20
    
23
    
-
 
24
	/** Minimize the angle between adjacent triangles. Almost the same as mean curvature 
-
 
25
		minimization */
21
	void minimize_dihedral_angle(HMesh::Manifold& m,
26
	void minimize_dihedral_angle(HMesh::Manifold& m,
22
															 int max_iter=10000,
27
															 int max_iter=10000,
23
															 bool anneal=false,
28
															 bool anneal=false,
24
															 bool alpha=false,
29
															 bool alpha=false,
25
															 double gamma=4.0);
30
															 double gamma=4.0);
-
 
31
															 
-
 
32
	/** Minimizes mean curvature. This is really the same as dihedral angle optimization
-
 
33
		except that we weight by edge length */
26
  void minimize_curvature(HMesh::Manifold& m, bool anneal=false);
34
  void minimize_curvature(HMesh::Manifold& m, bool anneal=false);
-
 
35
  
-
 
36
  /// Minimizes gaussian curvature. Probably less useful than mean curvature.
27
  void minimize_gauss_curvature(HMesh::Manifold& m, bool anneal=false);
37
  void minimize_gauss_curvature(HMesh::Manifold& m, bool anneal=false);
-
 
38
  
-
 
39
  /// Maximizes the minimum angle of triangles. Makes the mesh more Delaunay.
28
  void maximize_min_angle(HMesh::Manifold& m, float thresh, bool anneal=false);
40
  void maximize_min_angle(HMesh::Manifold& m, float thresh, bool anneal=false);
-
 
41
  
-
 
42
  /// Tries to achieve valence 6 internally and 4 along edges.
29
  void optimize_valency(HMesh::Manifold& m, bool anneal=false);
43
  void optimize_valency(HMesh::Manifold& m, bool anneal=false);
-
 
44
  
-
 
45
  /// Make radom flips. Useful for generating synthetic test cases.
30
  void randomize_mesh(HMesh::Manifold& m, int max_iter);
46
  void randomize_mesh(HMesh::Manifold& m, int max_iter);
31
 
47
 
32
}
48
}
33
 
49
 
34
 
50