-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrbfpatterns.cpp
More file actions
72 lines (63 loc) · 1.39 KB
/
Copy pathrbfpatterns.cpp
File metadata and controls
72 lines (63 loc) · 1.39 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
62
63
64
65
66
67
68
69
70
71
72
#include "StdAfx.h"
#include "rbfpatterns.h"
rbfpatterns::rbfpatterns(void)
{
number_of_pat = 0;
size_x = 0;
size_y = 0;
f = NULL;
pattern = NULL;
}
rbfpatterns::~rbfpatterns(void)
{
}
void rbfpatterns::print_pattern(int number)
{
printf("\n\n");
for (int i = 0 ; i < size_x ; i++) {
printf("\n");
for (int j = 0 ; j < size_y ; j++) {
if (pattern[number].pixel[i][j] > 0)
printf("%d ", 1);
else
printf("%d ", 0);
//printf("%d ", pattern[number].pixel[i][j]);
}
}
}
bool rbfpatterns::open_file(char *name)
{
if( !(f=fopen(name,"rt")))
return(false);
else
return(true);
}
void rbfpatterns::read_patterns(short act_function)
{
char temp[100];
int pat;
fscanf(f, "%s", &temp);
fscanf(f, "%d", &number_of_pat);
fscanf(f, "%s", &temp);
fscanf(f, "%d", &size_x);
fscanf(f, "%s", &temp);
fscanf(f, "%d", &size_y);
fscanf(f, "%s", &temp);
pattern = new patterns[number_of_pat];
for (int a = 0 ; a < number_of_pat ; a++) {
pattern[a].pixel = new int*[size_x];
for (int b = 0 ; b < size_x ; b++) {
pattern[a].pixel[b] = new int [size_y];
}
}
for (int k = 0 ; k < number_of_pat ; k++) {
fscanf(f, "%d", &pattern[k].code);
for (int i = 0 ; i < size_x ; i++) {
for (int j = 0 ; j < size_y ; j++) {
fscanf(f, "%d", &pat);
pattern[k].pixel[i][j] = pat;
}
}
}
fclose(f);
}