Allink  v0.1
DrDefinition.cpp
1 #include "DrEffect.h"
2 
5  Patch = (int **)calloc(49,sizeof(int));
6  for(int i=0;i<49;i++)
7  Patch[i] = (int *)calloc(4*4,sizeof(int));
8  int np = 0;
9  Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
10  Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
11  Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1;
12  Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 1;
13  np = 1;
14  Mat->Transform(Patch[np],Patch[0],4,OP_INVERT);
15  np = 2;
16  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
17  Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
18  Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1;
19  Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1;
20  np = 4;
21  Mat->Transform(Patch[np],Patch[2],4,OP_INVERT);
22  np = 13;
23  Mat->Transform(Patch[np],Patch[2],4,OP_ROT_90);
24  np = 12;
25  Mat->Transform(Patch[np],Patch[13],4,OP_INVERT);
26  np = 3;
27  Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 0;
28  Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0;
29  Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0;
30  Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0;
31  np = 5;
32  Mat->Transform(Patch[np],Patch[3],4,OP_MIRROR);
33  np = 6;
34  Mat->Transform(Patch[np],Patch[3],4,OP_INVERT);
35  np = 7;
36  Mat->Transform(Patch[np],Patch[6],4,OP_MIRROR);
37  np = 8;
38  Mat->Transform(Patch[np],Patch[3],4,OP_ROT_90);
39  np = 9;
40  Mat->Transform(Patch[np],Patch[8],4,OP_ROT_180);
41  np = 10;
42  Mat->Transform(Patch[np],Patch[9],4,OP_INVERT);
43  np = 11;
44  Mat->Transform(Patch[np],Patch[8],4,OP_INVERT);
45  np = 14;
46  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 0;Patch[np][3 ] = 0;
47  Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
48  Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1;
49  Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 1;
50  np = 16;
51  Mat->Transform(Patch[np],Patch[14],4,OP_MIRROR);
52  np = 21;
53  Mat->Transform(Patch[np],Patch[16],4,OP_INVERT);
54  np = 22;
55  Mat->Transform(Patch[np],Patch[14],4,OP_INVERT);
56  np = 17;
57  Mat->Transform(Patch[np],Patch[21],4,OP_ROT_180);
58  np = 20;
59  Mat->Transform(Patch[np],Patch[17],4,OP_MIRROR);
60  np = 18;
61  Mat->Transform(Patch[np],Patch[20],4,OP_INVERT);
62  np = 19;
63  Mat->Transform(Patch[np],Patch[18],4,OP_MIRROR);
64  np = 15;
65  Patch[np][0 ] = 0;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 0;
66  Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0;
67  Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0;
68  Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0;
69  np = 23;
70  Mat->Transform(Patch[np],Patch[15],4,OP_INVERT);
71  np = 33;
72  Mat->Transform(Patch[np],Patch[23],4,OP_ROT_90);
73  np = 35;
74  Mat->Transform(Patch[np],Patch[15],4,OP_ROT_90);
75  np = 24;
76  Patch[np][0 ] = 1;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
77  Patch[np][4 ] = 1;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
78  Patch[np][8 ] = 1;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1;
79  Patch[np][12] = 1;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1;
80  np = 25;
81  Mat->Transform(Patch[np],Patch[24],4,OP_MIRROR);
82  np = 26;
83  Mat->Transform(Patch[np],Patch[24],4,OP_INVERT);
84  np = 27;
85  Mat->Transform(Patch[np],Patch[26],4,OP_MIRROR);
86  np = 28;
87  Mat->Transform(Patch[np],Patch[24],4,OP_ROT_90);
88  np = 29;
89  Mat->Transform(Patch[np],Patch[28],4,OP_ROT_180);
90  np = 30;
91  Mat->Transform(Patch[np],Patch[29],4,OP_INVERT);
92  np = 31;
93  Mat->Transform(Patch[np],Patch[30],4,OP_ROT_180);
94  np = 32;
95  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
96  Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
97  Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0;
98  Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0;
99  np = 34;
100  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 0;
101  Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 0;
102  Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0;
103  Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0;
104  np = 36;
105  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
106  Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0;
107  Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 0;Patch[np][11] = 0;
108  Patch[np][12] = 1;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0;
109  np = 37;
110  Mat->Transform(Patch[np],Patch[36],4,OP_ROT_180);
111  np = 38;
112  Mat->Transform(Patch[np],Patch[37],4,OP_INVERT);
113  np = 39;
114  Mat->Transform(Patch[np],Patch[37],4,OP_ROT_90);
115  np = 42;
116  Mat->Transform(Patch[np],Patch[36],4,OP_ROT_90);
117  np = 43;
118  Mat->Transform(Patch[np],Patch[42],4,OP_INVERT);
119  np = 40;
120  Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 0;Patch[np][3 ] = 0;
121  Patch[np][4 ] = 1;Patch[np][5 ] = 0;Patch[np][6 ] = 0;Patch[np][7 ] = 1;
122  Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1;
123  Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1;
124  np = 41;
125  Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
126  Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0;
127  Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0;
128  Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 0;Patch[np][15] = 0;
129  np = 44;
130  Mat->Transform(Patch[np],Patch[41],4,OP_MIRROR);
131  np = 46;
132  Mat->Transform(Patch[np],Patch[44],4,OP_INVERT);
133  np = 45;
134  Patch[np][0 ] = 1;Patch[np][1 ] = 0;Patch[np][2 ] = 0;Patch[np][3 ] = 1;
135  Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 1;
136  Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1;
137  Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0;
138  np = 47;
139  Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 1;
140  Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 0;Patch[np][7 ] = 0;
141  Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1;
142  Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0;
143  np = 48;
144  Mat->Transform(Patch[np],Patch[47],4,OP_INVERT);
145  return;
146  FILE *Ciccia = fopen("Patches.xvl","w");
147  double Spaz = 1./46.;
148  double Riga = 0.;
149  double Col = 0.;
150  fprintf(Ciccia,"#l(1. 1. 1.) v[46]");
151  for(int j=0;j<7;j++){
152  for(int r=0;r<4;r++){
153  for(int i=0;i<7;i++){
154  for(int c=0;c<4;c++){
155  fprintf(Ciccia,"{x(%lf %lf %lf) ",Riga,Col,0.);
156  double Colore = Patch[7*j+i][r*4+c] == 0 ? 0. : 1.0;
157  fprintf(Ciccia,"v(%lf %lf %lf) }\n",Colore,Colore,Colore);
158  Col += Spaz;
159  }
160  Col += 2.*Spaz;
161  }
162  Riga += Spaz;
163  Col = 0.;
164  }
165  Riga += 2.*Spaz;
166  }
167 }
int Transform(int *Out, int *In, int NEdge, int operation)
Boh.
void Initialize()
Definition: DrDefinition.cpp:3