-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMeshComponent.cpp
More file actions
61 lines (48 loc) · 1.23 KB
/
Copy pathMeshComponent.cpp
File metadata and controls
61 lines (48 loc) · 1.23 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
58
59
60
61
#include "MeshComponent.h"
MeshComponent::MeshComponent(Type t, MPoint position, int i) {
pos = position;
type = t;
index = i;
matched = nullptr;
}
MeshComponent::MeshComponent() {
type = EMPTY;
//TODO Check if this is actually set
}
//TODO need to make this work for other enum types as well
bool MeshComponent::isEqualTo(MeshComponent* other){
if(type == VERTEX && other->type == VERTEX){
if(pos == other->pos){
return true;
}
}
else if (type == EMPTY && other->type == EMPTY){
return true;
}
return false;
}
void MeshComponent::addAdjacency(MeshComponent* adjacentComponent, bool isSecondAdd){
//We dont want to add adj info to itself
if(this == adjacentComponent)
return;
if(adjacentComponent->type == VERTEX){
adjacentVertices.insert(adjacentComponent);
}
else
adjacentFaces.insert(adjacentComponent);
adjacentComponents.insert(adjacentComponent);//contains all adjacent components
if(!isSecondAdd)
adjacentComponent->addAdjacency(this,true);
}
bool MeshComponent::hasAdjacency(MeshComponent* adjacentComponent)
{
int num = this->adjacentComponents.count(adjacentComponent);
if(num>0)
return true;
else
return false;
}
void MeshComponent::addComponentMatch(ComponentMatch* cM)
{
matched = cM;
}