ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/meta/convect.c
Revision: 1.1
Committed: Sat Feb 22 02:07:26 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
CVS Tags: rad3R6P1, rad3R5, rad3R6
Log Message:
Changes and check-in for 3.5 release
Includes new source files and modifications not recorded for many years
See ray/doc/notes/ReleaseNotes for notes between 3.1 and 3.5 release

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id$";
3 #endif
4 /*
5 * Convert vector file of type A to segments
6 *
7 * 1/16/85
8 *
9 * cc convect.c primout.o hfio.o syscalls.o misc.o
10 */
11
12
13 #include "meta.h"
14
15 #define MAXX 32
16
17 #define MAXY 32
18
19 #define MINX 0
20
21 #define MINY 0
22
23 #define CVX(x) ((int)((long)(x-MINX)*(XYSIZE-1)/(MAXX-MINX)))
24
25 #define CVY(y) ((int)((long)(y-MINY)*(XYSIZE-1)/(MAXY-MINY)))
26
27 char *progname;
28
29
30 main(argc, argv) /* single argument is input file name */
31
32 int argc;
33 char **argv;
34
35 {
36 char stemp[16];
37 int i, npairs;
38 FILE *fp;
39 PRIMITIVE curp;
40 int x, y, lastx, lasty;
41
42 progname = *argv++;
43 argc--;
44
45 if (argc != 1)
46 error(USER, "arg count");
47
48 fp = efopen(*argv, "r");
49
50 while (fscanf(fp, "%s", stemp) == 1) {
51
52 fscanf(fp, "%*d %*d %*d %*d");
53 curp.com = POPEN;
54 curp.arg0 = 0;
55 curp.xy[XMN] = curp.xy[YMN] = curp.xy[XMX] = curp.xy[YMX] = -1;
56 curp.args = stemp;
57 writep(&curp, stdout);
58
59 for ( ; ; ) {
60 fscanf(fp, "%d", &i);
61 if (i == 0)
62 break;
63 fscanf(fp, "%d", &npairs);
64 for (i = 0; i < npairs; i++) {
65 fscanf(fp, "%d %d", &x, &y);
66 x = CVX(x);
67 y = CVY(y);
68 if (i)
69 plseg(0, lastx, lasty, x, y, stdout);
70 lastx = x;
71 lasty = y;
72 }
73 }
74 curp.com = PCLOSE;
75 curp.arg0 = 0200;
76 curp.xy[XMN] = curp.xy[YMN] = curp.xy[XMX] = curp.xy[YMX] = -1;
77 curp.args = NULL;
78 writep(&curp, stdout);
79 }
80
81 writeof(stdout);
82 fclose(fp);
83
84 return(0);
85 }