Allink
v0.1
|
00001 #include "DrEffect.h" 00002 00003 void DrEffect::Initialize(){ 00005 Patch = (int **)calloc(49,sizeof(int)); 00006 for(int i=0;i<49;i++) 00007 Patch[i] = (int *)calloc(4*4,sizeof(int)); 00008 int np = 0; 00009 Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00010 Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00011 Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1; 00012 Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 1; 00013 np = 1; 00014 Mat->Transform(Patch[np],Patch[0],4,OP_INVERT); 00015 np = 2; 00016 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00017 Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00018 Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1; 00019 Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1; 00020 np = 4; 00021 Mat->Transform(Patch[np],Patch[2],4,OP_INVERT); 00022 np = 13; 00023 Mat->Transform(Patch[np],Patch[2],4,OP_ROT_90); 00024 np = 12; 00025 Mat->Transform(Patch[np],Patch[13],4,OP_INVERT); 00026 np = 3; 00027 Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 0; 00028 Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0; 00029 Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0; 00030 Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0; 00031 np = 5; 00032 Mat->Transform(Patch[np],Patch[3],4,OP_MIRROR); 00033 np = 6; 00034 Mat->Transform(Patch[np],Patch[3],4,OP_INVERT); 00035 np = 7; 00036 Mat->Transform(Patch[np],Patch[6],4,OP_MIRROR); 00037 np = 8; 00038 Mat->Transform(Patch[np],Patch[3],4,OP_ROT_90); 00039 np = 9; 00040 Mat->Transform(Patch[np],Patch[8],4,OP_ROT_180); 00041 np = 10; 00042 Mat->Transform(Patch[np],Patch[9],4,OP_INVERT); 00043 np = 11; 00044 Mat->Transform(Patch[np],Patch[8],4,OP_INVERT); 00045 np = 14; 00046 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 0;Patch[np][3 ] = 0; 00047 Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00048 Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1; 00049 Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 1; 00050 np = 16; 00051 Mat->Transform(Patch[np],Patch[14],4,OP_MIRROR); 00052 np = 21; 00053 Mat->Transform(Patch[np],Patch[16],4,OP_INVERT); 00054 np = 22; 00055 Mat->Transform(Patch[np],Patch[14],4,OP_INVERT); 00056 np = 17; 00057 Mat->Transform(Patch[np],Patch[21],4,OP_ROT_180); 00058 np = 20; 00059 Mat->Transform(Patch[np],Patch[17],4,OP_MIRROR); 00060 np = 18; 00061 Mat->Transform(Patch[np],Patch[20],4,OP_INVERT); 00062 np = 19; 00063 Mat->Transform(Patch[np],Patch[18],4,OP_MIRROR); 00064 np = 15; 00065 Patch[np][0 ] = 0;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 0; 00066 Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0; 00067 Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0; 00068 Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0; 00069 np = 23; 00070 Mat->Transform(Patch[np],Patch[15],4,OP_INVERT); 00071 np = 33; 00072 Mat->Transform(Patch[np],Patch[23],4,OP_ROT_90); 00073 np = 35; 00074 Mat->Transform(Patch[np],Patch[15],4,OP_ROT_90); 00075 np = 24; 00076 Patch[np][0 ] = 1;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00077 Patch[np][4 ] = 1;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00078 Patch[np][8 ] = 1;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1; 00079 Patch[np][12] = 1;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1; 00080 np = 25; 00081 Mat->Transform(Patch[np],Patch[24],4,OP_MIRROR); 00082 np = 26; 00083 Mat->Transform(Patch[np],Patch[24],4,OP_INVERT); 00084 np = 27; 00085 Mat->Transform(Patch[np],Patch[26],4,OP_MIRROR); 00086 np = 28; 00087 Mat->Transform(Patch[np],Patch[24],4,OP_ROT_90); 00088 np = 29; 00089 Mat->Transform(Patch[np],Patch[28],4,OP_ROT_180); 00090 np = 30; 00091 Mat->Transform(Patch[np],Patch[29],4,OP_INVERT); 00092 np = 31; 00093 Mat->Transform(Patch[np],Patch[30],4,OP_ROT_180); 00094 np = 32; 00095 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00096 Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00097 Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0; 00098 Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0; 00099 np = 34; 00100 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 0; 00101 Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 1;Patch[np][7 ] = 0; 00102 Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0; 00103 Patch[np][12] = 0;Patch[np][13] = 1;Patch[np][14] = 1;Patch[np][15] = 0; 00104 np = 36; 00105 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00106 Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0; 00107 Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 0;Patch[np][11] = 0; 00108 Patch[np][12] = 1;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0; 00109 np = 37; 00110 Mat->Transform(Patch[np],Patch[36],4,OP_ROT_180); 00111 np = 38; 00112 Mat->Transform(Patch[np],Patch[37],4,OP_INVERT); 00113 np = 39; 00114 Mat->Transform(Patch[np],Patch[37],4,OP_ROT_90); 00115 np = 42; 00116 Mat->Transform(Patch[np],Patch[36],4,OP_ROT_90); 00117 np = 43; 00118 Mat->Transform(Patch[np],Patch[42],4,OP_INVERT); 00119 np = 40; 00120 Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 0;Patch[np][3 ] = 0; 00121 Patch[np][4 ] = 1;Patch[np][5 ] = 0;Patch[np][6 ] = 0;Patch[np][7 ] = 1; 00122 Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1; 00123 Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 1;Patch[np][15] = 1; 00124 np = 41; 00125 Patch[np][0 ] = 0;Patch[np][1 ] = 0;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00126 Patch[np][4 ] = 0;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 0; 00127 Patch[np][8 ] = 0;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 0; 00128 Patch[np][12] = 1;Patch[np][13] = 1;Patch[np][14] = 0;Patch[np][15] = 0; 00129 np = 44; 00130 Mat->Transform(Patch[np],Patch[41],4,OP_MIRROR); 00131 np = 46; 00132 Mat->Transform(Patch[np],Patch[44],4,OP_INVERT); 00133 np = 45; 00134 Patch[np][0 ] = 1;Patch[np][1 ] = 0;Patch[np][2 ] = 0;Patch[np][3 ] = 1; 00135 Patch[np][4 ] = 1;Patch[np][5 ] = 1;Patch[np][6 ] = 1;Patch[np][7 ] = 1; 00136 Patch[np][8 ] = 0;Patch[np][9 ] = 0;Patch[np][10] = 1;Patch[np][11] = 1; 00137 Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0; 00138 np = 47; 00139 Patch[np][0 ] = 1;Patch[np][1 ] = 1;Patch[np][2 ] = 1;Patch[np][3 ] = 1; 00140 Patch[np][4 ] = 0;Patch[np][5 ] = 0;Patch[np][6 ] = 0;Patch[np][7 ] = 0; 00141 Patch[np][8 ] = 1;Patch[np][9 ] = 1;Patch[np][10] = 1;Patch[np][11] = 1; 00142 Patch[np][12] = 0;Patch[np][13] = 0;Patch[np][14] = 0;Patch[np][15] = 0; 00143 np = 48; 00144 Mat->Transform(Patch[np],Patch[47],4,OP_INVERT); 00145 return; 00146 FILE *Ciccia = fopen("Patches.xvl","w"); 00147 double Spaz = 1./46.; 00148 double Riga = 0.; 00149 double Col = 0.; 00150 fprintf(Ciccia,"#l(1. 1. 1.) v[46]"); 00151 for(int j=0;j<7;j++){ 00152 for(int r=0;r<4;r++){ 00153 for(int i=0;i<7;i++){ 00154 for(int c=0;c<4;c++){ 00155 fprintf(Ciccia,"{x(%lf %lf %lf) ",Riga,Col,0.); 00156 double Colore = Patch[7*j+i][r*4+c] == 0 ? 0. : 1.0; 00157 fprintf(Ciccia,"v(%lf %lf %lf) }\n",Colore,Colore,Colore); 00158 Col += Spaz; 00159 } 00160 Col += 2.*Spaz; 00161 } 00162 Riga += Spaz; 00163 Col = 0.; 00164 } 00165 Riga += 2.*Spaz; 00166 } 00167 }