Last change
on this file since 3033 was
2273,
checked in by Sam Hocevar, 15 years ago
|
- Put the initial (Feb 08) version of the ED displacement paper into SVN, as
well as the associated C source code. Both will require huge cleanup for a
final release.
|
File size:
721 bytes
|
Line | |
---|
1 | #include <stdio.h> |
---|
2 | |
---|
3 | #define N 128 |
---|
4 | |
---|
5 | #if 1 |
---|
6 | #define X1 -.1 |
---|
7 | #define X2 .4 |
---|
8 | #define Y1 -.05 |
---|
9 | #define Y2 .45 |
---|
10 | #endif |
---|
11 | |
---|
12 | int tab[N][N]; |
---|
13 | |
---|
14 | int main(void) |
---|
15 | { |
---|
16 | float fx, fy; |
---|
17 | int x, y; |
---|
18 | |
---|
19 | for(;;) |
---|
20 | { |
---|
21 | if(fscanf(stdin, "%g %g\n", &fx, &fy) != 2) |
---|
22 | break; |
---|
23 | |
---|
24 | x = (N - 0.000001) * (fx - X1) / (X2 - X1); |
---|
25 | y = (N - 0.000001) * (fy - Y1) / (Y2 - Y1); |
---|
26 | if(x < 0 || y < 0 || x >= N || y >= N) |
---|
27 | continue; |
---|
28 | |
---|
29 | tab[x][y]++; |
---|
30 | } |
---|
31 | |
---|
32 | for(y = 0; y < N; y++) |
---|
33 | { |
---|
34 | for(x = 0; x < N; x++) |
---|
35 | printf("%g %g %i\n", (float)x * (X2 - X1) / (N - 1) + X1, |
---|
36 | (float)y * (Y2 - Y1) / (N - 1) + Y1, tab[x][y]); |
---|
37 | printf("\n"); |
---|
38 | } |
---|
39 | |
---|
40 | return 0; |
---|
41 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.