diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/gd/libgd/mathmake.c | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/gd/libgd/mathmake.c')
-rw-r--r-- | ext/gd/libgd/mathmake.c | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/ext/gd/libgd/mathmake.c b/ext/gd/libgd/mathmake.c new file mode 100644 index 0000000..3950c4b --- /dev/null +++ b/ext/gd/libgd/mathmake.c @@ -0,0 +1,52 @@ +#include <stdio.h> +#include <math.h> + +#define scale 1024 + +int basis[91]; +int cost[360]; + +main (void) +{ + int i; + printf ("#define costScale %d\n", scale); + printf ("int cost[] = {\n "); + for (i = 0; (i <= 90); i++) + { + basis[i] = cos ((double) i * .0174532925) * scale; + } + for (i = 0; (i < 90); i++) + { + printf ("%d,\n ", cost[i] = basis[i]); + } + for (i = 90; (i < 180); i++) + { + printf ("%d,\n ", cost[i] = -basis[180 - i]); + } + for (i = 180; (i < 270); i++) + { + printf ("%d,\n ", cost[i] = -basis[i - 180]); + } + for (i = 270; (i < 359); i++) + { + printf ("%d,\n ", cost[i] = basis[360 - i]); + } + printf ("%d\n", cost[359] = basis[1]); + printf ("};\n"); + printf ("#define sintScale %d\n", scale); + printf ("int sint[] = {\n "); + for (i = 0; (i < 360); i++) + { + int val; + val = cost[(i + 270) % 360]; + if (i != 359) + { + printf ("%d,\n ", val); + } + else + { + printf ("%d\n", val); + } + } + printf ("};\n"); +} |