/[opencvs]/eyes/points.c
ViewVC logotype

Contents of /eyes/points.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations)
Wed Mar 9 09:39:56 2011 UTC (7 years, 5 months ago) by hib
Branch: MAIN
File MIME type: text/plain
eyes - the best fucking mosaic out there
1 #include <stdio.h>
2 #define veronika
3
4
5 #ifdef salka
6 #define WIDTH 132
7 #define HEIGHT 136
8 #endif
9
10 #ifdef veronika
11 #define WIDTH 144
12 #define HEIGHT 48
13 #endif
14
15 int there[WIDTH][HEIGHT];
16 int there2[WIDTH][HEIGHT];
17 int *pos;
18
19 int points (){
20 int width=WIDTH;
21 int height=HEIGHT;
22 int x,y;
23 int size;
24 pos = (int *) there2;
25 for (x=0;x<width;x++) {
26 for (y=0;y<height;y++) {
27 there[x][y] = 0;
28 pos[y*width+x] = y*width+x;
29 }
30 }
31 size=width*height;
32
33 #define set(x,y,c,e) {there[x][y]=e;int cc;cc=(c);if (cc==-1) cc=y*width+x;printf("%010d|%d|%d\n",e,x,y);size=size-1;pos[cc]=pos[size];}
34
35
36 #ifdef salka
37 set(91,47,-1,1);
38 set(108,44,-1,1);
39 set(103,64,-1,1);
40 set(96,89,-1,1);
41 srand(4336734);
42 #endif
43 #ifdef veronika
44 set(58,31,-1,1);
45 set(106,34,-1,1);
46 srand(1223857631);
47 #endif
48
49 while (size) {
50 int c,d,e;
51 c = (rand()>>1) % (size);
52 d = pos[c];
53 x = d % width;
54 y = d / width;
55 if (there[x][y]) {
56 fprintf(stderr,"no %d %d %d %d\n",c,d,x,y);
57 exit(1);
58 }
59 if ( (x && (e=there[x-1][y])) ||
60 ((x<width-1)&&(e=there[x+1][y])) ||
61 ((y<height-1)&&(e=there[x][y+1])) ||
62 ((y)&&(e=there[x][y-1])) ) {
63 e++;
64 set(x,y,c,e);
65 }
66 }
67 return 0;
68 }
69
70 int main()
71 {
72 points();
73 }

  ViewVC Help
Powered by ViewVC 1.1.5