Back to index

wims  3.65+svn20090927
Defines | Functions | Variables
mathmake.c File Reference
#include <stdio.h>
#include <math.h>

Go to the source code of this file.

Defines

#define scale   1024

Functions

 main (void)

Variables

int basis [91]
int cost [360]

Define Documentation

#define scale   1024

Definition at line 4 of file mathmake.c.


Function Documentation

main ( void  )

Definition at line 9 of file mathmake.c.

           {
       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");
}

Variable Documentation

int basis[91]

Definition at line 6 of file mathmake.c.

int cost[360]

Definition at line 7 of file mathmake.c.