diff options
| author | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-20 02:46:41 +0100 | 
|---|---|---|
| committer | Dirk Engling <erdgeist@erdgeist.org> | 2014-02-20 02:46:41 +0100 | 
| commit | 64c85dfc1d3b546dd4b5f84168e9256817f3a741 (patch) | |
| tree | e3de2e7a99362bfa1dfcde3d4bad3e76af179c61 /src/postprocess/makepic.c | |
| parent | 632c350fcf2021620afd032994e6e32c34c6dbfb (diff) | |
clean up source directory
Diffstat (limited to 'src/postprocess/makepic.c')
| -rw-r--r-- | src/postprocess/makepic.c | 62 | 
1 files changed, 62 insertions, 0 deletions
| diff --git a/src/postprocess/makepic.c b/src/postprocess/makepic.c new file mode 100644 index 0000000..5c54cbd --- /dev/null +++ b/src/postprocess/makepic.c | |||
| @@ -0,0 +1,62 @@ | |||
| 1 | //#define MUENCHEN | ||
| 2 | //#define MAGDEBURG | ||
| 3 | #define BREMEN | ||
| 4 | |||
| 5 | #ifdef MUENCHEN | ||
| 6 | /* Muenchen */ | ||
| 7 | #define GEOXMIN 5295821.0 | ||
| 8 | #define GEOXMAX 5334858.0 | ||
| 9 | #define GEOYMIN 3233408.0 | ||
| 10 | #define GEOYMAX 3270042.0 | ||
| 11 | #endif | ||
| 12 | |||
| 13 | #ifdef MAGDEBURG | ||
| 14 | /* Magdeburg */ | ||
| 15 | #define GEOXMIN 5305003.0 | ||
| 16 | #define GEOXMAX 5316797.0 | ||
| 17 | #define GEOYMIN 3682236.0 | ||
| 18 | #define GEOYMAX 3704266.0 | ||
| 19 | #endif | ||
| 20 | |||
| 21 | #ifdef BREMEN | ||
| 22 | /* Bremen */ | ||
| 23 | #define GEOXMIN 5098053.0 | ||
| 24 | #define GEOXMAX 5134674.0 | ||
| 25 | #define GEOYMIN 3784147.0 | ||
| 26 | #define GEOYMAX 3819770.0 | ||
| 27 | #endif | ||
| 28 | |||
| 29 | #define GEOXSIZE (GEOXMAX - GEOXMIN) | ||
| 30 | #define GEOYSIZE (GEOYMAX - GEOYMIN) | ||
| 31 | |||
| 32 | #define PICXSIZE (2*768.0) | ||
| 33 | #define PICYSIZE (2*768.0) | ||
| 34 | |||
| 35 | #include <stdio.h> | ||
| 36 | #include <math.h> | ||
| 37 | |||
| 38 | int main( int args, char **argv) | ||
| 39 | { | ||
| 40 | unsigned long pic[ (long)(PICXSIZE * (PICYSIZE+10)) ]; | ||
| 41 | char line[1024]; | ||
| 42 | int x, y; | ||
| 43 | |||
| 44 | double xscale = (PICXSIZE / GEOXSIZE), | ||
| 45 | yscale = (PICYSIZE / GEOYSIZE); | ||
| 46 | double scale = xscale > yscale ? yscale : xscale; | ||
| 47 | |||
| 48 | memset( pic, 0, sizeof( pic)); | ||
| 49 | |||
| 50 | while( scanf( "%ld\t%ld\n", &x, &y) == 2) | ||
| 51 | { | ||
| 52 | double myx = x - GEOXMIN, myy = GEOYSIZE - (y - GEOYMIN); | ||
| 53 | if( (x < GEOXMAX) && (x >= GEOXMIN) && (y < GEOYMAX) && (y >= GEOYMIN)) | ||
| 54 | pic[ (long)(((long)(myx * scale)) + ((long)( myy * scale )) * (long)PICXSIZE) ]++; | ||
| 55 | } | ||
| 56 | |||
| 57 | printf( "P5\n%ld %ld\n255\n", (long)PICXSIZE, (long)PICYSIZE ); | ||
| 58 | for( x = 0; x < PICXSIZE * PICYSIZE; x++) | ||
| 59 | putchar( sqrt( 32*256*256 * pic[ x ])); | ||
| 60 | |||
| 61 | return 0; | ||
| 62 | } | ||
