summaryrefslogtreecommitdiff
path: root/src/postprocess/makepic.c
blob: 5c54cbdda8119d35670e10f7b67da4a3f97b07f6 (plain)
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
//#define MUENCHEN
//#define MAGDEBURG
#define BREMEN

#ifdef MUENCHEN
/* Muenchen */
#define GEOXMIN 5295821.0
#define GEOXMAX 5334858.0
#define GEOYMIN 3233408.0
#define GEOYMAX 3270042.0
#endif

#ifdef MAGDEBURG
/* Magdeburg */
#define GEOXMIN 5305003.0
#define GEOXMAX 5316797.0
#define GEOYMIN 3682236.0
#define GEOYMAX 3704266.0
#endif

#ifdef BREMEN
/* Bremen */
#define GEOXMIN 5098053.0
#define GEOXMAX 5134674.0
#define GEOYMIN 3784147.0
#define GEOYMAX 3819770.0
#endif

#define GEOXSIZE (GEOXMAX - GEOXMIN)
#define GEOYSIZE (GEOYMAX - GEOYMIN)

#define PICXSIZE (2*768.0)
#define PICYSIZE (2*768.0)

#include <stdio.h>
#include <math.h>

int main( int args, char **argv)
{
  unsigned long pic[ (long)(PICXSIZE * (PICYSIZE+10)) ];
  char          line[1024];
  int           x, y;

  double        xscale = (PICXSIZE / GEOXSIZE),
                yscale = (PICYSIZE / GEOYSIZE);
  double        scale  = xscale > yscale ? yscale : xscale;

  memset( pic, 0, sizeof( pic));

  while( scanf( "%ld\t%ld\n", &x, &y) == 2)
  {
    double myx = x - GEOXMIN, myy = GEOYSIZE - (y - GEOYMIN);
    if( (x < GEOXMAX) && (x >= GEOXMIN) && (y < GEOYMAX) && (y >= GEOYMIN))
      pic[ (long)(((long)(myx * scale)) + ((long)( myy * scale )) * (long)PICXSIZE) ]++;
  }

  printf( "P5\n%ld %ld\n255\n", (long)PICXSIZE, (long)PICYSIZE );
  for( x = 0; x < PICXSIZE * PICYSIZE; x++)
    putchar( sqrt( 32*256*256 * pic[ x ]));

  return 0;
}