7 |
|
|
8 |
|
#include <stdio.h> |
9 |
|
#include <stdlib.h> |
10 |
+ |
#include <string.h> |
11 |
|
#include <math.h> |
12 |
+ |
|
13 |
+ |
#include "meta.h" |
14 |
|
#include "random.h" |
15 |
< |
#include "mgflib/parser.h" |
15 |
> |
#include "mgf_parser.h" |
16 |
> |
#include "plocate.h" /* XXX shouldn't this rather be in rtmath.h? */ |
17 |
|
|
18 |
|
#define MSIZE ((1<<14)-1) |
19 |
|
#define MX(v) (int)(MSIZE*(v)[(proj_axis+1)%3]) |
20 |
|
#define MY(v) (int)(MSIZE*(v)[(proj_axis+2)%3]) |
21 |
|
|
18 |
– |
int r_face(); |
22 |
|
int proj_axis; |
23 |
|
double limit[3][2]; |
24 |
|
int layer; |
26 |
|
|
27 |
|
extern int mg_nqcdivs; |
28 |
|
|
29 |
+ |
static int r_face(int ac, char **av); |
30 |
+ |
static void newlayer(void); |
31 |
+ |
static int doline(int v1x, int v1y, int v2x, int v2y); |
32 |
|
|
33 |
< |
main(argc, argv) /* convert files to stdout */ |
34 |
< |
int argc; |
35 |
< |
char *argv[]; |
33 |
> |
|
34 |
> |
int |
35 |
> |
main( /* convert files to stdout */ |
36 |
> |
int argc, |
37 |
> |
char *argv[] |
38 |
> |
) |
39 |
|
{ |
40 |
|
int i; |
41 |
|
/* initialize dispatch table */ |
78 |
|
|
79 |
|
|
80 |
|
int |
81 |
< |
r_face(ac, av) /* convert a face */ |
82 |
< |
int ac; |
83 |
< |
char **av; |
81 |
> |
r_face( /* convert a face */ |
82 |
> |
int ac, |
83 |
> |
char **av |
84 |
> |
) |
85 |
|
{ |
86 |
|
static FVECT bbmin = {0,0,0}, bbmax = {1,1,1}; |
87 |
|
register int i, j; |
119 |
|
(long)(mx2)<<5 ^ (long)(my2)) |
120 |
|
|
121 |
|
|
122 |
< |
newlayer() /* start a new layer */ |
122 |
> |
void |
123 |
> |
newlayer(void) /* start a new layer */ |
124 |
|
{ |
125 |
< |
#ifdef BSD |
115 |
< |
bzero((char *)hshtab, sizeof(hshtab)); |
116 |
< |
#else |
117 |
< |
(void)memset((char *)hshtab, 0, sizeof(hshtab)); |
118 |
< |
#endif |
125 |
> |
(void)memset((char *)hshtab, '\0', sizeof(hshtab)); |
126 |
|
if (++layer >= 16) { |
127 |
|
mendpage(); |
128 |
|
layer = 0; |
131 |
|
|
132 |
|
|
133 |
|
int |
134 |
< |
doline(v1x, v1y, v2x, v2y) /* draw line conditionally */ |
135 |
< |
int v1x, v1y, v2x, v2y; |
134 |
> |
doline( /* draw line conditionally */ |
135 |
> |
int v1x, |
136 |
> |
int v1y, |
137 |
> |
int v2x, |
138 |
> |
int v2y |
139 |
> |
) |
140 |
|
{ |
141 |
|
register int h; |
142 |
|
|
151 |
|
hshtab[h][0] = v1x; hshtab[h][1] = v1y; |
152 |
|
hshtab[h][2] = v2x; hshtab[h][3] = v2y; |
153 |
|
if ((long)(v2x-v1x)*(v2x-v1x) + (long)(v2y-v1y)*(v2y-v1y) |
154 |
< |
<= random() % rthresh) |
154 |
> |
<= irandom(rthresh)) |
155 |
|
return(0); |
156 |
|
mline(v1x, v1y, layer/4, 0, layer%4); |
157 |
|
mdraw(v2x, v2y); |