gd1
5
About: A graphics library for fast GIF creation
Fossies
Dox
:
gd1.5.tar.gz
("inofficial" and yet experimental doxygen-generated source code documentation)
Main Page
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Macros
mathmake.c
Go to the documentation of this file.
1
#include <stdio.h>
2
#include <math.h>
3
4
#define scale 1024
5
6
int
basis
[91];
7
int
cost
[360];
8
9
main
(
void
) {
10
int
i;
11
printf(
"#define costScale %d\n"
,
scale
);
12
printf(
"int cost[] = {\n "
);
13
for
(i=0; (i <= 90); i++) {
14
basis
[i] = cos((
double
)i * .0174532925) *
scale
;
15
}
16
for
(i=0; (i < 90); i++) {
17
printf(
"%d,\n "
,
cost
[i] =
basis
[i]);
18
}
19
for
(i=90; (i < 180); i++) {
20
printf(
"%d,\n "
,
cost
[i] = -
basis
[180-i]);
21
}
22
for
(i=180; (i < 270); i++) {
23
printf(
"%d,\n "
,
cost
[i] = -
basis
[i-180]);
24
}
25
for
(i=270; (i < 359); i++) {
26
printf(
"%d,\n "
,
cost
[i] =
basis
[360-i]);
27
}
28
printf(
"%d\n"
,
cost
[359] =
basis
[1]);
29
printf(
"};\n"
);
30
printf(
"#define sintScale %d\n"
,
scale
);
31
printf(
"int sint[] = {\n "
);
32
for
(i=0; (i<360); i++) {
33
int
val;
34
val =
cost
[(i + 270) % 360];
35
if
(i != 359) {
36
printf(
"%d,\n "
, val);
37
}
else
{
38
printf(
"%d\n"
, val);
39
}
40
}
41
printf(
"};\n"
);
42
}
43
gd1.5
mathmake.c
Generated by
1.8.3.1-20130402