Subversion Repositories gelsvn

Rev

Rev 399 | Rev 457 | 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
 
403 jab 19
 
391 jab 20
class Harmonics
21
{
22
	HMesh::Manifold& mani;
23
 
24
	int maximum_eigenvalue;
386 jab 25
 
391 jab 26
	static bool is_initialized;
27
	static GLuint prog_P0;
28
 
29
	std::vector<CGLA::Vec3d> proj;
30
 
31
	LinAlg::CMatrix Q;
32
	LinAlg::CVector V;
33
	std::vector<float> max_eig_values;
386 jab 34
 
391 jab 35
	void make_laplace_operator();
388 jab 36
 
391 jab 37
public:
38
 
39
	/// Initialize API (must be called first)
40
	static void init();
41
 
42
	/// Initial analysis of harmonics (must be called second)
43
	Harmonics(HMesh::Manifold& mani);
44
 
45
	/// Add a frequency to mesh reconstruction
46
	void add_frequency(int f, float scale = 1.0f);
47
 
48
	/// Reset the shape to use 0 eigenvalues
49
	void reset_shape();
50
 
51
	/// Do a partial reconstruct with an interval of eigenvalues
52
	void partial_reconstruct(int E0, int E1, float scale=1.0f);
53
 
54
	/// Parse keystrokes that would influence the interactive display
55
	void parse_key(unsigned char key);
56
 
57
	/// Draw with eigenvalues
58
	void draw();
59
 
399 jab 60
};
61
 
403 jab 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
 
399 jab 76
#endif
77