Subversion Repositories gelsvn

Rev

Rev 399 | Rev 457 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 399 Rev 403
1
/*
1
/*
2
 *  harmonics.h
2
 *  harmonics.h
3
 *  GEL
3
 *  GEL
4
 *
4
 *
5
 *  Created by J. Andreas Bærentzen on 01/09/08.
5
 *  Created by J. Andreas Bærentzen on 01/09/08.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
6
 *  Copyright 2008 __MyCompanyName__. All rights reserved.
7
 *
7
 *
8
 */
8
 */
9
 
9
 
10
#ifndef __MESHEDIT_HARMONICS_H__
10
#ifndef __MESHEDIT_HARMONICS_H__
11
#define __MESHEDIT_HARMONICS_H__
11
#define __MESHEDIT_HARMONICS_H__
12
 
12
 
13
#include <CGLA/Vec3d.h>
13
#include <CGLA/Vec3d.h>
14
#include <HMesh/Manifold.h>
14
#include <HMesh/Manifold.h>
15
#include <LinAlg/Matrix.h>
15
#include <LinAlg/Matrix.h>
16
#include <LinAlg/Vector.h>
16
#include <LinAlg/Vector.h>
17
#include <LinAlg/LapackFunc.h>
17
#include "Renderer.h"
-
 
18
 
18
 
19
 
19
class Harmonics
20
class Harmonics
20
{
21
{
21
	HMesh::Manifold& mani;
22
	HMesh::Manifold& mani;
22
	
23
	
23
	int maximum_eigenvalue;
24
	int maximum_eigenvalue;
24
 
25
 
25
	static bool is_initialized;
26
	static bool is_initialized;
26
	static GLuint prog_P0;
27
	static GLuint prog_P0;
27
	
28
	
28
	std::vector<CGLA::Vec3d> proj;
29
	std::vector<CGLA::Vec3d> proj;
29
	
30
	
30
	LinAlg::CMatrix Q;
31
	LinAlg::CMatrix Q;
31
	LinAlg::CVector V;
32
	LinAlg::CVector V;
32
	std::vector<float> max_eig_values;
33
	std::vector<float> max_eig_values;
33
 
34
 
34
	void make_laplace_operator();
35
	void make_laplace_operator();
35
 
36
 
36
public:
37
public:
37
	
38
	
38
	/// Initialize API (must be called first)
39
	/// Initialize API (must be called first)
39
	static void init();
40
	static void init();
40
	
41
	
41
	/// Initial analysis of harmonics (must be called second)
42
	/// Initial analysis of harmonics (must be called second)
42
	Harmonics(HMesh::Manifold& mani);
43
	Harmonics(HMesh::Manifold& mani);
43
	
44
	
44
	/// Add a frequency to mesh reconstruction
45
	/// Add a frequency to mesh reconstruction
45
	void add_frequency(int f, float scale = 1.0f);
46
	void add_frequency(int f, float scale = 1.0f);
46
	
47
	
47
	/// Reset the shape to use 0 eigenvalues
48
	/// Reset the shape to use 0 eigenvalues
48
	void reset_shape();
49
	void reset_shape();
49
	
50
	
50
	/// Do a partial reconstruct with an interval of eigenvalues
51
	/// Do a partial reconstruct with an interval of eigenvalues
51
	void partial_reconstruct(int E0, int E1, float scale=1.0f);
52
	void partial_reconstruct(int E0, int E1, float scale=1.0f);
52
	
53
	
53
	/// Parse keystrokes that would influence the interactive display
54
	/// Parse keystrokes that would influence the interactive display
54
	void parse_key(unsigned char key);
55
	void parse_key(unsigned char key);
55
	
56
	
56
	/// Draw with eigenvalues
57
	/// Draw with eigenvalues
57
	void draw();
58
	void draw();
58
	
59
	
59
};
60
};
60
 
61
 
-
 
62
 
-
 
63
class HarmonicsRenderer: public ManifoldRenderer
-
 
64
	{
-
 
65
		
-
 
66
	public:
-
 
67
		HarmonicsRenderer(Harmonics* h)
-
 
68
		{
-
 
69
			glNewList(display_list,GL_COMPILE);
-
 
70
			if(h) h->draw();
-
 
71
			glEndList();
-
 
72
		}
-
 
73
	};
-
 
74
 
-
 
75
 
61
#endif
76
#endif
62
 
77
 
63
 
78