Subversion Repositories gelsvn

Rev

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

Rev 403 Rev 457
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 "Renderer.h"
17
#include "Renderer.h"
18
 
18
 
-
 
19
#define USE_SPARSE_MATRIX 1
-
 
20
 
19
 
21
 
20
class Harmonics
22
class Harmonics
21
{
23
{
22
	HMesh::Manifold& mani;
24
	HMesh::Manifold& mani;
23
	
25
	
24
	int maximum_eigenvalue;
26
	int maximum_eigenvalue;
25
 
27
 
26
	static bool is_initialized;
28
	static bool is_initialized;
27
	static GLuint prog_P0;
29
	static GLuint prog_P0;
28
	
30
	
29
	std::vector<CGLA::Vec3d> proj;
31
	std::vector<CGLA::Vec3d> proj;
30
	
32
	
31
	LinAlg::CMatrix Q;
33
	LinAlg::CMatrix Q;
-
 
34
	LinAlg::CVector qnorm;
32
	LinAlg::CVector V;
35
	LinAlg::CVector V;
-
 
36
	LinAlg::CVector S;
33
	std::vector<float> max_eig_values;
37
	std::vector<float> max_eig_values;
34
 
38
 
35
	void make_laplace_operator();
39
	void make_laplace_operator();
-
 
40
	void make_laplace_operator_sparse();
36
 
41
 
37
public:
42
public:
38
	
43
	
39
	/// Initialize API (must be called first)
44
	/// Initialize API (must be called first)
40
	static void init();
45
	static void init();
41
	
46
	
42
	/// Initial analysis of harmonics (must be called second)
47
	/// Initial analysis of harmonics (must be called second)
43
	Harmonics(HMesh::Manifold& mani);
48
	Harmonics(HMesh::Manifold& mani);
44
	
49
	
45
	/// Add a frequency to mesh reconstruction
50
	/// Add a frequency to mesh reconstruction
46
	void add_frequency(int f, float scale = 1.0f);
51
	void add_frequency(int f, float scale = 1.0f);
47
	
52
	
48
	/// Reset the shape to use 0 eigenvalues
53
	/// Reset the shape to use 0 eigenvalues
49
	void reset_shape();
54
	void reset_shape();
50
	
55
	
51
	/// Do a partial reconstruct with an interval of eigenvalues
56
	/// Do a partial reconstruct with an interval of eigenvalues
52
	void partial_reconstruct(int E0, int E1, float scale=1.0f);
57
	void partial_reconstruct(int E0, int E1, float scale=1.0f);
53
	
58
	
54
	/// Parse keystrokes that would influence the interactive display
59
	/// Parse keystrokes that would influence the interactive display
55
	void parse_key(unsigned char key);
60
	void parse_key(unsigned char key);
56
	
61
	
57
	/// Draw with eigenvalues
62
	/// Draw with eigenvalues
58
	void draw();
63
	void draw_adf();
59
	
64
	
60
};
65
};
61
 
66
 
62
 
67
 
63
class HarmonicsRenderer: public ManifoldRenderer
68
class HarmonicsRenderer: public ManifoldRenderer
64
	{
69
	{
65
		
70
		
66
	public:
71
	public:
67
		HarmonicsRenderer(Harmonics* h)
72
		HarmonicsRenderer(Harmonics* h)
68
		{
73
		{
69
			glNewList(display_list,GL_COMPILE);
74
			glNewList(display_list,GL_COMPILE);
70
			if(h) h->draw();
75
			if(h) h->draw_adf();
71
			glEndList();
76
			glEndList();
72
		}
77
		}
73
	};
78
	};
74
 
79
 
75
 
80
 
76
#endif
81
#endif
77
 
82
 
78
 
83