home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Encyclopedia of Graphics File Formats Companion
/
GFF_CD.ISO
/
formats
/
ttddd
/
code
/
chain.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-06-20
|
1KB
|
50 lines
/* chain.c - generate chain - Glenn M. Lewis - 2/18/90 */
#include <stdio.h>
#include <math.h>
#ifndef PI
#define PI 3.14159265
#endif
#define RADIUS 200.0
main()
{
int i;
printf("%% TTDDD file, created by chain.c\n");
printf("%% Written by Glenn M. Lewis\n\n");
printf("OBJ Begin\nDESC Begin\nNAME \"AXIS\"\nEND DESC\n\n");
for (i=0; i<360; i+=36) {
do_up(i);
do_side(i+18);
}
printf("TOBJ\nEnd OBJ\n");
}
do_up(i)
int i;
{
double c, s;
c = cos((double)PI*i/180.0);
s = sin((double)PI*i/180.0);
printf("EXTR Begin\nMTRX Trans %0.4lf %0.4lf 0\n", s*RADIUS, -c*RADIUS);
printf("MTRX Rotate %0.4lf 0 %0.4lf %0.4lf 0 %0.4lf 0 1 0\n", c, s, s, -c);
printf("LOAD \"VD0:link_xy.tddd\"\nEnd EXTR\n\n");
}
do_side(i)
int i;
{
double c, s;
c = cos((double)PI*i/180.0);
s = sin((double)PI*i/180.0);
printf("EXTR Begin\nMTRX Trans %0.4lf %0.4lf 0\n", s*RADIUS, -c*RADIUS);
printf("MTRX Rotate %0.4lf %0.4lf 0 %0.4lf %0.4lf 0 0 0 1\n", c, -s, s, c);
printf("LOAD \"VD0:link_xy.tddd\"\nEnd EXTR\n\n");
}