Subversion Repositories gelsvn

Rev

Rev 403 | Rev 596 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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