-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMatchComputer.h
More file actions
57 lines (43 loc) · 1.73 KB
/
Copy pathMatchComputer.h
File metadata and controls
57 lines (43 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <vector>
#include "ComponentMatch.h"
#include "MeshComponent.h"
#include "glm\glm.hpp"
#include <maya/MPointArray.h>
#include <maya/MFnMeshData.h>
#include <maya/MFnMesh.h>
#include <maya/MVector.h>
using namespace std;
using namespace glm;
class MatchComputer {
//Keeps track of how many unmatched elements there are intially
int numUnmatched;
//HEAP STUFF
void makeHeap(vector<ComponentMatch*> &data); // make heap, wrapper function
void heapify(int index, vector<ComponentMatch*> &data);
void swap(int a, int b, vector<ComponentMatch*> &data);
public:
vector<MeshComponent*> originalMeshComponents;
vector<MeshComponent*> originalMeshFaceComponents;
vector<MeshComponent*> derivativeMeshComponents;
MatchComputer();
MatchComputer(MPointArray* originalVerts, MPointArray* derivativeVerts, MFnMesh* oMeshFn , MFnMesh* dMeshFn);
void makeComponentMatches();
void makeComponents(MPointArray* originalVerts, MPointArray* derivativeVerts);
void matchGreedy();
int iterationCount;
//Greedy algorithm helper methods
double computeCost(vector<ComponentMatch*> matches, int numUnmatched);
bool areMatchComponentsInVector(ComponentMatch* matchA, vector<ComponentMatch*> matches);
void removeFromUnmatched(ComponentMatch* match);
ComponentMatch* getAndRemoveLowestComponentMatch();
//Gredy Algorithm Data Structure
vector<ComponentMatch*> allComponentMatches; // all possible matches
vector<ComponentMatch*> bestComponentMatches;
vector<MeshComponent*> unmatchedOriginalMeshComponents;
vector<MeshComponent*> unmatchedDerivativeMeshComponents;
MPointArray* unmatchedOriginalMeshPoints;//<--used for drawing later
MPointArray* unmatchedDerivativeMeshPoints;
MFnMesh* originalMeshFn;
MFnMesh* derivativeMeshFn;
};