688 |
khor |
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 |
|
|
|
10 |
#ifndef __MESHEDIT_HARMONICS_H__
|
|
|
11 |
#define __MESHEDIT_HARMONICS_H__
|
|
|
12 |
|
|
|
13 |
#include "../CGLA/Vec3d.h"
|
|
|
14 |
#include "../HMesh/Manifold.h"
|
|
|
15 |
#include "../HMesh/AttributeVector.h"
|
|
|
16 |
#include "../LinAlg/Matrix.h"
|
|
|
17 |
#include "../LinAlg/Vector.h"
|
|
|
18 |
|
|
|
19 |
namespace HMesh {
|
|
|
20 |
|
|
|
21 |
class Harmonics
|
|
|
22 |
{
|
|
|
23 |
HMesh::Manifold& mani;
|
|
|
24 |
HMesh::VertexAttributeVector<int> vtouched;
|
|
|
25 |
|
|
|
26 |
int maximum_eigenvalue;
|
|
|
27 |
|
|
|
28 |
bool is_initialized;
|
|
|
29 |
|
|
|
30 |
std::vector<CGLA::Vec3d> proj;
|
|
|
31 |
|
|
|
32 |
LinAlg::CMatrix Q;
|
|
|
33 |
LinAlg::CVector qnorm;
|
|
|
34 |
LinAlg::CVector V;
|
|
|
35 |
LinAlg::CVector S;
|
|
|
36 |
|
|
|
37 |
std::vector<float> max_eig_values;
|
|
|
38 |
|
|
|
39 |
void make_laplace_operator();
|
|
|
40 |
void make_laplace_operator_sparse();
|
|
|
41 |
|
|
|
42 |
public:
|
|
|
43 |
|
|
|
44 |
std::vector<CGLA::Vec3d> analyze_signal(const HMesh::VertexAttributeVector<CGLA::Vec3d>& sig);
|
|
|
45 |
|
|
|
46 |
HMesh::VertexAttributeVector<CGLA::Vec3d> reconstruct_signal(const std::vector<CGLA::Vec3d>& sig_proj, int);
|
|
|
47 |
|
|
|
48 |
/// Initial analysis of harmonics
|
|
|
49 |
Harmonics(HMesh::Manifold& mani);
|
|
|
50 |
|
|
|
51 |
/// Add a frequency to mesh reconstruction
|
|
|
52 |
void add_frequency(int f, float scale = 1.0f);
|
|
|
53 |
|
|
|
54 |
/// Reset the shape to use 0 eigenvalues
|
|
|
55 |
void reset_shape();
|
|
|
56 |
|
|
|
57 |
/// Do a partial reconstruct with an interval of eigenvalues
|
|
|
58 |
void partial_reconstruct(int E0, int E1, float scale=1.0f);
|
|
|
59 |
|
|
|
60 |
double compute_adf(HMesh::VertexAttributeVector<double>& adf, double t, double fiedler_boost=0);
|
|
|
61 |
|
|
|
62 |
double compute_esum(HMesh::VertexAttributeVector<double>& adf, int e0, int e1);
|
|
|
63 |
|
|
|
64 |
};
|
|
|
65 |
|
|
|
66 |
}
|
|
|
67 |
#endif
|
|
|
68 |
|