forked from Kaylians/Implementacion_HWFC_C_PlusPlus
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPattern.cpp
68 lines (58 loc) · 2.06 KB
/
Pattern.cpp
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
62
63
64
65
66
67
68
#include "Pixel.h"
#include "Pattern.h"
//constructor
Pattern::Pattern(int id, int N) : id(id),N(N) {}
bool Pattern::comparePixelPattern(const std::vector<Pixel>& otherPixeles) {
if (otherPixeles.size() != pixeles.size()) {
return false;
}
return otherPixeles == pixeles;
}
bool Pattern::compareCooPattern(const std::vector<int>& otherPixeles) {
if (otherPixeles.size() != pixelesCoo.size()) {
return false;
}
return otherPixeles == pixelesCoo;
}
std::vector<Pixel> Pattern::rotatePattern(const std::vector<Pixel>& Pattern) {
std::vector<Pixel> newPattern;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j >= 0; j--) {
newPattern.push_back(Pattern[N * j + i]);
}
}
return newPattern;
}
std::vector<int> Pattern::rotatePatternCoo(const std::vector<int>& Pattern) {
std::vector<int> newPattern;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j >= 0; j--) {
newPattern.push_back(Pattern[N * j + i]);
}
}
return newPattern;
}
std::vector<Pixel> Pattern::mirrorPattern(const std::vector<Pixel>& Pattern) {
std::vector<Pixel> newPattern;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j >= 0; j--) {
newPattern.push_back(Pattern[j + i * N]);
}
}
return newPattern;
}
std::vector<int> Pattern::mirrorPatternCoo(const std::vector<int>& Pattern) {
std::vector<int> newPattern;
for (int i = 0; i < N; i++) {
for (int j = N - 1; j >= 0; j--) {
newPattern.push_back(Pattern[j + i * N]);
}
}
return newPattern;
}
void Pattern::addPixelVector(std::vector<Pixel> newPixeles) {
pixeles = newPixeles;
}
void Pattern::addPixelCooVector(std::vector<int> newPixeles) {
pixelesCoo = newPixeles;
}