5 |
|
#endif |
6 |
|
|
7 |
|
/* |
8 |
< |
* Convert MGF (Materials and Geometry Format) to Metafile graphics |
8 |
> |
* Convert MGF (Materials and Geometry Format) to Metafile 2-d graphics |
9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
12 |
|
#include <math.h> |
13 |
|
#include "mgflib/parser.h" |
14 |
|
|
15 |
< |
#define MX(v) (int)((1<<14)*(v)[(proj_axis+1)%3]) |
16 |
< |
#define MY(v) (int)((1<<14)*(v)[(proj_axis+2)%3]) |
15 |
> |
#define MX(v) (int)(((1<<14)-1)*(v)[(proj_axis+1)%3]) |
16 |
> |
#define MY(v) (int)(((1<<14)-1)*(v)[(proj_axis+2)%3]) |
17 |
|
|
18 |
|
int r_face(); |
19 |
|
int proj_axis; |
44 |
|
if (argc == 8) { /* convert stdin */ |
45 |
|
if (mg_load(NULL) != MG_OK) |
46 |
|
exit(1); |
47 |
+ |
mendpage(); |
48 |
|
} else /* convert each file */ |
49 |
< |
for (i = 8; i < argc; i++) |
49 |
> |
for (i = 8; i < argc; i++) { |
50 |
|
if (mg_load(argv[i]) != MG_OK) |
51 |
|
exit(1); |
52 |
< |
mendpage(); /* close output */ |
53 |
< |
mdone(); |
52 |
> |
mendpage(); |
53 |
> |
} |
54 |
> |
mdone(); /* close output */ |
55 |
|
exit(0); |
56 |
|
userr: |
57 |
|
fprintf(stderr, "Usage: %s {x|y|z} xmin xmax ymin ymax zmin zmax [file.mgf] ..\n", |