14 |
|
|
15 |
|
#include "platform.h" |
16 |
|
#include "rtio.h" |
17 |
< |
#include "rtprocess.h" |
17 |
> |
#include "paths.h" |
18 |
|
#include "fvect.h" |
19 |
|
|
20 |
|
#ifdef M_PI |
23 |
|
#define PI 3.14159265358979323846 |
24 |
|
#endif |
25 |
|
|
26 |
– |
#define FEQ(a,b) ((a)-(b) <= 1e-7 && (b)-(a) <= 1e-7) |
27 |
– |
|
26 |
|
#define MAXVERT 6 /* maximum number of vertices for markers */ |
27 |
|
#define MAXMARK 128 /* maximum number of markers */ |
28 |
|
|
139 |
|
void |
140 |
|
convert( /* replace marks in a stream */ |
141 |
|
char *name, |
142 |
< |
register FILE *fin |
142 |
> |
FILE *fin |
143 |
|
) |
144 |
|
{ |
145 |
< |
register int c; |
145 |
> |
int c; |
146 |
|
|
147 |
|
while ((c = getc(fin)) != EOF) { |
148 |
|
if (isspace(c)) /* blank */ |
172 |
|
) |
173 |
|
{ |
174 |
|
FILE *pin; |
175 |
< |
char buf[512], *fgetline(); |
175 |
> |
char buf[512]; |
176 |
|
|
177 |
|
fgetline(buf, sizeof(buf), fin); |
178 |
|
if (expand) { |
183 |
|
exit(1); |
184 |
|
} |
185 |
|
convert(buf, pin); |
186 |
< |
pclose(pin); |
186 |
> |
if (pclose(pin) != 0) |
187 |
> |
fprintf(stderr, |
188 |
> |
"%s: (%s): warning - bad status from \"%s\"\n", |
189 |
> |
progname, fname, buf); |
190 |
|
} else |
191 |
|
printf("\n%s\n", buf); |
192 |
|
} |
198 |
|
FILE *fin |
199 |
|
) |
200 |
|
{ |
200 |
– |
extern char *fgetword(); |
201 |
|
char buf[128], typ[16], nam[128]; |
202 |
|
int i, n; |
203 |
< |
register int j; |
203 |
> |
int j; |
204 |
|
|
205 |
|
if (fgetword(buf, sizeof(buf), fin) == NULL || |
206 |
|
fgetword(typ, sizeof(typ), fin) == NULL || |
245 |
|
void |
246 |
|
replace( /* replace marker */ |
247 |
|
char *fname, |
248 |
< |
register struct mrkr *m, |
248 |
> |
struct mrkr *m, |
249 |
|
char *mark, |
250 |
|
FILE *fin |
251 |
|
) |
299 |
|
|
300 |
|
int |
301 |
|
buildxf( /* build transform for marker */ |
302 |
< |
register char *xf, |
302 |
> |
char *xf, |
303 |
|
double markscale, |
304 |
|
FILE *fin |
305 |
|
) |
309 |
|
FVECT xvec, yvec, zvec; |
310 |
|
double xlen; |
311 |
|
int n; |
312 |
< |
register int i; |
312 |
> |
int i; |
313 |
|
/* |
314 |
|
* Read and sort vectors: longest is hypotenuse, |
315 |
|
* second longest is x' axis, |
382 |
|
|
383 |
|
int |
384 |
|
addrot( /* compute rotation (x,y,z) => (xp,yp,zp) */ |
385 |
< |
register char *xf, |
385 |
> |
char *xf, |
386 |
|
FVECT xp, |
387 |
|
FVECT yp, |
388 |
|
FVECT zp |
401 |
|
} |
402 |
|
n = 0; |
403 |
|
theta = atan2(yp[2], zp[2]); |
404 |
< |
if (!FEQ(theta,0.0)) { |
404 |
> |
if (!FABSEQ(theta,0.0)) { |
405 |
|
sprintf(xf, " -rx %f", theta*(180./PI)); |
406 |
|
while (*xf) ++xf; |
407 |
|
n += 2; |
408 |
|
} |
409 |
< |
theta = asin(-xp[2]); |
410 |
< |
if (!FEQ(theta,0.0)) { |
409 |
> |
theta = Asin(-xp[2]); |
410 |
> |
if (!FABSEQ(theta,0.0)) { |
411 |
|
sprintf(xf, " -ry %f", theta*(180./PI)); |
412 |
|
while (*xf) ++xf; |
413 |
|
n += 2; |
414 |
|
} |
415 |
|
theta = atan2(xp[1], xp[0]); |
416 |
< |
if (!FEQ(theta,0.0)) { |
416 |
> |
if (!FABSEQ(theta,0.0)) { |
417 |
|
sprintf(xf, " -rz %f", theta*(180./PI)); |
418 |
|
/* while (*xf) ++xf; */ |
419 |
|
n += 2; |