10 |
|
|
11 |
|
#include "standard.h" |
12 |
|
|
13 |
+ |
#include <sys/fcntl.h> |
14 |
+ |
|
15 |
|
#include "view.h" |
16 |
|
|
17 |
|
#include "color.h" |
18 |
|
|
19 |
< |
#define pscan(y) (ourpict+(y)*ourview.hresolu) |
20 |
< |
#define zscan(y) (ourzbuf+(y)*ourview.hresolu) |
19 |
> |
#define pscan(y) (ourpict+(y)*hresolu) |
20 |
> |
#define zscan(y) (ourzbuf+(y)*hresolu) |
21 |
|
|
22 |
|
#define F_FORE 1 /* fill foreground */ |
23 |
|
#define F_BACK 2 /* fill background */ |
30 |
|
|
31 |
|
struct position {int x,y; float z;}; |
32 |
|
|
33 |
< |
VIEW ourview = STDVIEW(512); /* desired view */ |
33 |
> |
VIEW ourview = STDVIEW; /* desired view */ |
34 |
> |
int hresolu = 512; /* horizontal resolution */ |
35 |
> |
int vresolu = 512; /* vertical resolution */ |
36 |
> |
double pixaspect = 1.0; /* pixel aspect ratio */ |
37 |
|
|
38 |
|
double zeps = .02; /* allowed z epsilon */ |
39 |
|
|
50 |
|
int normdist = 1; /* normalized distance? */ |
51 |
|
double ourexp = -1; /* output picture exposure */ |
52 |
|
|
53 |
< |
VIEW theirview = STDVIEW(512); /* input view */ |
53 |
> |
VIEW theirview = STDVIEW; /* input view */ |
54 |
|
int gotview; /* got input view? */ |
55 |
< |
double theirs2ours[4][4]; /* transformation matrix */ |
55 |
> |
int thresolu, tvresolu; /* input resolution */ |
56 |
|
double theirexp; /* input picture exposure */ |
57 |
+ |
double theirs2ours[4][4]; /* transformation matrix */ |
58 |
|
|
59 |
|
int childpid = -1; /* id of fill process */ |
60 |
|
FILE *psend, *precv; /* pipes to/from fill calculation */ |
71 |
|
int gotvfile = 0; |
72 |
|
char *zfile = NULL; |
73 |
|
char *err; |
74 |
< |
int i; |
74 |
> |
int i, rval; |
75 |
|
|
76 |
|
progname = argv[0]; |
77 |
|
|
78 |
< |
for (i = 1; i < argc && argv[i][0] == '-'; i++) |
78 |
> |
for (i = 1; i < argc && argv[i][0] == '-'; i++) { |
79 |
> |
rval = getviewopt(&ourview, argc-i, argv+i); |
80 |
> |
if (rval >= 0) { |
81 |
> |
i += rval; |
82 |
> |
continue; |
83 |
> |
} |
84 |
|
switch (argv[i][1]) { |
85 |
|
case 't': /* threshold */ |
86 |
|
check(2,1); |
135 |
|
break; |
136 |
|
case 'x': /* x resolution */ |
137 |
|
check(2,1); |
138 |
< |
ourview.hresolu = atoi(argv[++i]); |
138 |
> |
hresolu = atoi(argv[++i]); |
139 |
|
break; |
140 |
|
case 'y': /* y resolution */ |
141 |
|
check(2,1); |
142 |
< |
ourview.vresolu = atoi(argv[++i]); |
142 |
> |
vresolu = atoi(argv[++i]); |
143 |
|
break; |
144 |
< |
case 'v': /* view */ |
145 |
< |
switch (argv[i][2]) { |
146 |
< |
case 't': /* type */ |
147 |
< |
check(4,0); |
148 |
< |
ourview.type = argv[i][3]; |
149 |
< |
break; |
139 |
< |
case 'p': /* point */ |
140 |
< |
check(3,3); |
141 |
< |
ourview.vp[0] = atof(argv[++i]); |
142 |
< |
ourview.vp[1] = atof(argv[++i]); |
143 |
< |
ourview.vp[2] = atof(argv[++i]); |
144 |
< |
break; |
145 |
< |
case 'd': /* direction */ |
146 |
< |
check(3,3); |
147 |
< |
ourview.vdir[0] = atof(argv[++i]); |
148 |
< |
ourview.vdir[1] = atof(argv[++i]); |
149 |
< |
ourview.vdir[2] = atof(argv[++i]); |
150 |
< |
break; |
151 |
< |
case 'u': /* up */ |
152 |
< |
check(3,3); |
153 |
< |
ourview.vup[0] = atof(argv[++i]); |
154 |
< |
ourview.vup[1] = atof(argv[++i]); |
155 |
< |
ourview.vup[2] = atof(argv[++i]); |
156 |
< |
break; |
157 |
< |
case 'h': /* horizontal */ |
158 |
< |
check(3,1); |
159 |
< |
ourview.horiz = atof(argv[++i]); |
160 |
< |
break; |
161 |
< |
case 'v': /* vertical */ |
162 |
< |
check(3,1); |
163 |
< |
ourview.vert = atof(argv[++i]); |
164 |
< |
break; |
165 |
< |
case 'f': /* file */ |
166 |
< |
check(3,1); |
167 |
< |
gotvfile = viewfile(argv[++i], &ourview); |
168 |
< |
if (gotvfile < 0) { |
169 |
< |
perror(argv[i]); |
170 |
< |
exit(1); |
171 |
< |
} else if (gotvfile == 0) { |
172 |
< |
fprintf(stderr, "%s: bad view file\n", |
173 |
< |
argv[i]); |
174 |
< |
exit(1); |
175 |
< |
} |
176 |
< |
break; |
177 |
< |
default: |
144 |
> |
case 'p': /* pixel aspect */ |
145 |
> |
check(2,1); |
146 |
> |
pixaspect = atof(argv[++i]); |
147 |
> |
break; |
148 |
> |
case 'v': /* view file */ |
149 |
> |
if (argv[i][2] != 'f') |
150 |
|
goto badopt; |
151 |
+ |
check(3,1); |
152 |
+ |
gotvfile = viewfile(argv[++i], &ourview, 0, 0); |
153 |
+ |
if (gotvfile < 0) { |
154 |
+ |
perror(argv[i]); |
155 |
+ |
exit(1); |
156 |
+ |
} else if (gotvfile == 0) { |
157 |
+ |
fprintf(stderr, "%s: bad view file\n", |
158 |
+ |
argv[i]); |
159 |
+ |
exit(1); |
160 |
|
} |
161 |
|
break; |
162 |
|
default: |
165 |
|
progname, argv[i]); |
166 |
|
goto userr; |
167 |
|
} |
168 |
+ |
} |
169 |
|
/* check arguments */ |
170 |
|
if ((argc-i)%2) |
171 |
|
goto userr; |
174 |
|
fprintf(stderr, "%s: %s\n", progname, err); |
175 |
|
exit(1); |
176 |
|
} |
177 |
+ |
normaspect(viewaspect(&ourview), &pixaspect, &hresolu, &vresolu); |
178 |
|
/* allocate frame */ |
179 |
< |
ourpict = (COLR *)malloc(ourview.hresolu*ourview.vresolu*sizeof(COLR)); |
180 |
< |
ourzbuf = (float *)calloc(ourview.hresolu*ourview.vresolu,sizeof(float)); |
179 |
> |
ourpict = (COLR *)malloc(hresolu*vresolu*sizeof(COLR)); |
180 |
> |
ourzbuf = (float *)calloc(hresolu*vresolu,sizeof(float)); |
181 |
|
if (ourpict == NULL || ourzbuf == NULL) |
182 |
|
syserror(); |
183 |
|
/* get input */ |
197 |
|
fprintview(&ourview, stdout); |
198 |
|
printf("\n"); |
199 |
|
} |
200 |
< |
if (ourexp > 0 && ourexp != 1.0) |
200 |
> |
if (pixaspect < .99 || pixaspect > 1.01) |
201 |
> |
fputaspect(pixaspect, stdout); |
202 |
> |
if (ourexp > 0 && (ourexp < .995 || ourexp > 1.005)) |
203 |
|
fputexpos(ourexp, stdout); |
204 |
|
printf("\n"); |
205 |
|
/* write picture */ |
211 |
|
exit(0); |
212 |
|
userr: |
213 |
|
fprintf(stderr, |
214 |
< |
"Usage: %s [view opts][-t zthresh][-z zout][-fT][-n] pfile zspec ..\n", |
214 |
> |
"Usage: %s [view opts][-t eps][-z zout][-fT][-n] pfile zspec ..\n", |
215 |
|
progname); |
216 |
|
exit(1); |
217 |
|
#undef check |
232 |
|
} |
233 |
|
for (an = altname; *an != NULL; an++) |
234 |
|
if (!strncmp(*an, s, strlen(*an))) { |
235 |
< |
if (sscanview(&theirview, s+strlen(*an)) == 0) |
235 |
> |
if (sscanview(&theirview, s+strlen(*an)) > 0) |
236 |
|
gotview++; |
237 |
|
break; |
238 |
|
} |
243 |
|
char *pfile, *zspec; |
244 |
|
{ |
245 |
|
extern double atof(); |
246 |
< |
FILE *pfp, *zfp; |
246 |
> |
FILE *pfp; |
247 |
> |
int zfd; |
248 |
|
char *err; |
249 |
|
COLR *scanin; |
250 |
|
float *zin; |
260 |
|
gotview = 0; |
261 |
|
printf("%s:\n", pfile); |
262 |
|
getheader(pfp, headline); |
263 |
< |
if (!gotview || fgetresolu(&theirview.hresolu, &theirview.vresolu, pfp) |
263 |
> |
if (!gotview || fgetresolu(&thresolu, &tvresolu, pfp) |
264 |
|
!= (YMAJOR|YDECR)) { |
265 |
|
fprintf(stderr, "%s: picture view error\n", pfile); |
266 |
|
exit(1); |
276 |
|
/* compute transformation */ |
277 |
|
pixform(theirs2ours, &theirview, &ourview); |
278 |
|
/* allocate scanlines */ |
279 |
< |
scanin = (COLR *)malloc(theirview.hresolu*sizeof(COLR)); |
280 |
< |
zin = (float *)malloc(theirview.hresolu*sizeof(float)); |
281 |
< |
plast = (struct position *)calloc(theirview.hresolu, |
296 |
< |
sizeof(struct position)); |
279 |
> |
scanin = (COLR *)malloc(thresolu*sizeof(COLR)); |
280 |
> |
zin = (float *)malloc(thresolu*sizeof(float)); |
281 |
> |
plast = (struct position *)calloc(thresolu, sizeof(struct position)); |
282 |
|
if (scanin == NULL || zin == NULL || plast == NULL) |
283 |
|
syserror(); |
284 |
|
/* get z specification or file */ |
285 |
< |
if ((zfp = fopen(zspec, "r")) == NULL) { |
285 |
> |
if ((zfd = open(zspec, O_RDONLY)) == -1) { |
286 |
|
double zvalue; |
287 |
|
register int x; |
288 |
|
if (!isfloat(zspec) || (zvalue = atof(zspec)) <= 0.0) { |
289 |
|
perror(zspec); |
290 |
|
exit(1); |
291 |
|
} |
292 |
< |
for (x = 0; x < theirview.hresolu; x++) |
292 |
> |
for (x = 0; x < thresolu; x++) |
293 |
|
zin[x] = zvalue; |
294 |
|
} |
295 |
|
/* load image */ |
296 |
< |
for (y = theirview.vresolu-1; y >= 0; y--) { |
297 |
< |
if (freadcolrs(scanin, theirview.hresolu, pfp) < 0) { |
296 |
> |
for (y = tvresolu-1; y >= 0; y--) { |
297 |
> |
if (freadcolrs(scanin, thresolu, pfp) < 0) { |
298 |
|
fprintf(stderr, "%s: read error\n", pfile); |
299 |
|
exit(1); |
300 |
|
} |
301 |
< |
if (zfp != NULL |
302 |
< |
&& fread(zin,sizeof(float),theirview.hresolu,zfp) |
318 |
< |
< theirview.hresolu) { |
301 |
> |
if (zfd != -1 && read(zfd,zin,thresolu*sizeof(float)) |
302 |
> |
< thresolu*sizeof(float)) { |
303 |
|
fprintf(stderr, "%s: read error\n", zspec); |
304 |
|
exit(1); |
305 |
|
} |
310 |
|
free((char *)zin); |
311 |
|
free((char *)plast); |
312 |
|
fclose(pfp); |
313 |
< |
if (zfp != NULL) |
314 |
< |
fclose(zfp); |
313 |
> |
if (zfd != -1) |
314 |
> |
close(zfd); |
315 |
|
} |
316 |
|
|
317 |
|
|
322 |
|
double m4t[4][4]; |
323 |
|
|
324 |
|
setident4(xfmat); |
325 |
< |
xfmat[0][0] = vw1->vhinc[0]; |
326 |
< |
xfmat[0][1] = vw1->vhinc[1]; |
327 |
< |
xfmat[0][2] = vw1->vhinc[2]; |
328 |
< |
xfmat[1][0] = vw1->vvinc[0]; |
329 |
< |
xfmat[1][1] = vw1->vvinc[1]; |
330 |
< |
xfmat[1][2] = vw1->vvinc[2]; |
325 |
> |
xfmat[0][0] = vw1->hvec[0]; |
326 |
> |
xfmat[0][1] = vw1->hvec[1]; |
327 |
> |
xfmat[0][2] = vw1->hvec[2]; |
328 |
> |
xfmat[1][0] = vw1->vvec[0]; |
329 |
> |
xfmat[1][1] = vw1->vvec[1]; |
330 |
> |
xfmat[1][2] = vw1->vvec[2]; |
331 |
|
xfmat[2][0] = vw1->vdir[0]; |
332 |
|
xfmat[2][1] = vw1->vdir[1]; |
333 |
|
xfmat[2][2] = vw1->vdir[2]; |
335 |
|
xfmat[3][1] = vw1->vp[1]; |
336 |
|
xfmat[3][2] = vw1->vp[2]; |
337 |
|
setident4(m4t); |
338 |
< |
m4t[0][0] = vw2->vhinc[0]/vw2->vhn2; |
339 |
< |
m4t[1][0] = vw2->vhinc[1]/vw2->vhn2; |
340 |
< |
m4t[2][0] = vw2->vhinc[2]/vw2->vhn2; |
341 |
< |
m4t[3][0] = -DOT(vw2->vp,vw2->vhinc)/vw2->vhn2; |
342 |
< |
m4t[0][1] = vw2->vvinc[0]/vw2->vvn2; |
343 |
< |
m4t[1][1] = vw2->vvinc[1]/vw2->vvn2; |
344 |
< |
m4t[2][1] = vw2->vvinc[2]/vw2->vvn2; |
345 |
< |
m4t[3][1] = -DOT(vw2->vp,vw2->vvinc)/vw2->vvn2; |
338 |
> |
m4t[0][0] = vw2->hvec[0]/vw2->hn2; |
339 |
> |
m4t[1][0] = vw2->hvec[1]/vw2->hn2; |
340 |
> |
m4t[2][0] = vw2->hvec[2]/vw2->hn2; |
341 |
> |
m4t[3][0] = -DOT(vw2->vp,vw2->hvec)/vw2->hn2; |
342 |
> |
m4t[0][1] = vw2->vvec[0]/vw2->vn2; |
343 |
> |
m4t[1][1] = vw2->vvec[1]/vw2->vn2; |
344 |
> |
m4t[2][1] = vw2->vvec[2]/vw2->vn2; |
345 |
> |
m4t[3][1] = -DOT(vw2->vp,vw2->vvec)/vw2->vn2; |
346 |
|
m4t[0][2] = vw2->vdir[0]; |
347 |
|
m4t[1][2] = vw2->vdir[1]; |
348 |
|
m4t[2][2] = vw2->vdir[2]; |
362 |
|
struct position lastx, newpos; |
363 |
|
register int x; |
364 |
|
|
365 |
< |
for (x = theirview.hresolu-1; x >= 0; x--) { |
366 |
< |
pos[0] = x - .5*(theirview.hresolu-1); |
367 |
< |
pos[1] = y - .5*(theirview.vresolu-1); |
365 |
> |
lastx.z = 0; |
366 |
> |
for (x = thresolu-1; x >= 0; x--) { |
367 |
> |
pos[0] = (x+.5)/thresolu + theirview.hoff - .5; |
368 |
> |
pos[1] = (y+.5)/tvresolu + theirview.voff - .5; |
369 |
|
pos[2] = zline[x]; |
370 |
|
if (theirview.type == VT_PER) { |
371 |
|
if (normdist) /* adjust for eye-ray distance */ |
372 |
|
pos[2] /= sqrt( 1. |
373 |
< |
+ pos[0]*pos[0]*theirview.vhn2 |
374 |
< |
+ pos[1]*pos[1]*theirview.vvn2 ); |
373 |
> |
+ pos[0]*pos[0]*theirview.hn2 |
374 |
> |
+ pos[1]*pos[1]*theirview.vn2 ); |
375 |
|
pos[0] *= pos[2]; |
376 |
|
pos[1] *= pos[2]; |
377 |
|
} |
384 |
|
pos[0] /= pos[2]; |
385 |
|
pos[1] /= pos[2]; |
386 |
|
} |
387 |
< |
pos[0] += .5*ourview.hresolu; |
388 |
< |
pos[1] += .5*ourview.vresolu; |
389 |
< |
newpos.x = pos[0]; |
390 |
< |
newpos.y = pos[1]; |
387 |
> |
pos[0] += .5 - ourview.hoff; |
388 |
> |
pos[1] += .5 - ourview.voff; |
389 |
> |
newpos.x = pos[0] * hresolu; |
390 |
> |
newpos.y = pos[1] * vresolu; |
391 |
|
newpos.z = zline[x]; |
392 |
|
/* add pixel to our image */ |
393 |
< |
if (pos[0] >= 0 && newpos.x < ourview.hresolu |
394 |
< |
&& pos[1] >= 0 && newpos.y < ourview.vresolu) { |
393 |
> |
if (pos[0] >= 0 && newpos.x < hresolu |
394 |
> |
&& pos[1] >= 0 && newpos.y < vresolu) { |
395 |
|
addpixel(&newpos, &lastx, &lasty[x], pline[x], pos[2]); |
396 |
|
lasty[x].x = lastx.x = newpos.x; |
397 |
|
lasty[x].y = lastx.y = newpos.y; |
462 |
|
COLR pfill; |
463 |
|
register int x, i; |
464 |
|
/* get back buffer */ |
465 |
< |
yback = (int *)malloc(ourview.hresolu*sizeof(int)); |
465 |
> |
yback = (int *)malloc(hresolu*sizeof(int)); |
466 |
|
if (yback == NULL) |
467 |
|
syserror(); |
468 |
< |
for (x = 0; x < ourview.hresolu; x++) |
468 |
> |
for (x = 0; x < hresolu; x++) |
469 |
|
yback[x] = -2; |
470 |
|
/* |
471 |
|
* Xback and yback are the pixel locations of suitable |
474 |
|
* that there is no suitable background in this direction. |
475 |
|
*/ |
476 |
|
/* fill image */ |
477 |
< |
for (y = 0; y < ourview.vresolu; y++) { |
477 |
> |
for (y = 0; y < vresolu; y++) { |
478 |
|
xback = -2; |
479 |
< |
for (x = 0; x < ourview.hresolu; x++) |
479 |
> |
for (x = 0; x < hresolu; x++) |
480 |
|
if (zscan(y)[x] <= 0) { /* empty pixel */ |
481 |
|
/* |
482 |
|
* First, find background from above or below. |
483 |
|
* (farthest assigned pixel) |
484 |
|
*/ |
485 |
|
if (yback[x] == -2) { |
486 |
< |
for (i = y+1; i < ourview.vresolu; i++) |
486 |
> |
for (i = y+1; i < vresolu; i++) |
487 |
|
if (zscan(i)[x] > 0) |
488 |
|
break; |
489 |
< |
if (i < ourview.vresolu |
489 |
> |
if (i < vresolu |
490 |
|
&& (y <= 0 || zscan(y-1)[x] < zscan(i)[x])) |
491 |
|
yback[x] = i; |
492 |
|
else |
496 |
|
* Next, find background from left or right. |
497 |
|
*/ |
498 |
|
if (xback == -2) { |
499 |
< |
for (i = x+1; i < ourview.hresolu; i++) |
499 |
> |
for (i = x+1; i < hresolu; i++) |
500 |
|
if (zscan(y)[i] > 0) |
501 |
|
break; |
502 |
< |
if (i < ourview.hresolu |
502 |
> |
if (i < hresolu |
503 |
|
&& (x <= 0 || zscan(y)[x-1] < zscan(y)[i])) |
504 |
|
xback = i; |
505 |
|
else |
541 |
|
{ |
542 |
|
register int x, y; |
543 |
|
|
544 |
< |
for (y = 0; y < ourview.vresolu; y++) |
545 |
< |
for (x = 0; x < ourview.hresolu; x++) |
544 |
> |
for (y = 0; y < vresolu; y++) |
545 |
> |
for (x = 0; x < hresolu; x++) |
546 |
|
if (zscan(y)[x] <= 0) |
547 |
|
(*deffill)(x,y); |
548 |
|
} |
552 |
|
{ |
553 |
|
int y; |
554 |
|
|
555 |
< |
fputresolu(YMAJOR|YDECR, ourview.hresolu, ourview.vresolu, stdout); |
556 |
< |
for (y = ourview.vresolu-1; y >= 0; y--) |
557 |
< |
if (fwritecolrs(pscan(y), ourview.hresolu, stdout) < 0) |
555 |
> |
fputresolu(YMAJOR|YDECR, hresolu, vresolu, stdout); |
556 |
> |
for (y = vresolu-1; y >= 0; y--) |
557 |
> |
if (fwritecolrs(pscan(y), hresolu, stdout) < 0) |
558 |
|
syserror(); |
559 |
|
} |
560 |
|
|
564 |
|
{ |
565 |
|
extern double sqrt(); |
566 |
|
int donorm = normdist && ourview.type == VT_PER; |
567 |
< |
FILE *fp; |
567 |
> |
int fd; |
568 |
|
int y; |
569 |
|
float *zout; |
570 |
|
|
571 |
< |
if ((fp = fopen(fname, "w")) == NULL) { |
571 |
> |
if ((fd = open(fname, O_WRONLY|O_CREAT|O_TRUNC, 0666)) == -1) { |
572 |
|
perror(fname); |
573 |
|
exit(1); |
574 |
|
} |
575 |
|
if (donorm |
576 |
< |
&& (zout = (float *)malloc(ourview.hresolu*sizeof(float))) == NULL) |
576 |
> |
&& (zout = (float *)malloc(hresolu*sizeof(float))) == NULL) |
577 |
|
syserror(); |
578 |
< |
for (y = ourview.vresolu-1; y >= 0; y--) { |
578 |
> |
for (y = vresolu-1; y >= 0; y--) { |
579 |
|
if (donorm) { |
580 |
|
double vx, yzn2; |
581 |
|
register int x; |
582 |
< |
yzn2 = y - .5*(ourview.vresolu-1); |
583 |
< |
yzn2 = 1. + yzn2*yzn2*ourview.vvn2; |
584 |
< |
for (x = 0; x < ourview.hresolu; x++) { |
585 |
< |
vx = x - .5*(ourview.hresolu-1); |
582 |
> |
yzn2 = y - .5*(vresolu-1); |
583 |
> |
yzn2 = 1. + yzn2*yzn2*ourview.vn2; |
584 |
> |
for (x = 0; x < hresolu; x++) { |
585 |
> |
vx = x - .5*(hresolu-1); |
586 |
|
zout[x] = zscan(y)[x] |
587 |
< |
* sqrt(vx*vx*ourview.vhn2 + yzn2); |
587 |
> |
* sqrt(vx*vx*ourview.hn2 + yzn2); |
588 |
|
} |
589 |
|
} else |
590 |
|
zout = zscan(y); |
591 |
< |
if (fwrite(zout, sizeof(float), ourview.hresolu, fp) |
592 |
< |
< ourview.hresolu) { |
591 |
> |
if (write(fd, zout, hresolu*sizeof(float)) |
592 |
> |
< hresolu*sizeof(float)) { |
593 |
|
perror(fname); |
594 |
|
exit(1); |
595 |
|
} |
596 |
|
} |
597 |
|
if (donorm) |
598 |
|
free((char *)zout); |
599 |
< |
fclose(fp); |
599 |
> |
close(fd); |
600 |
|
} |
601 |
|
|
602 |
|
|
689 |
|
clearqueue(); |
690 |
|
} |
691 |
|
/* send new ray */ |
692 |
< |
rayview(orig, dir, &ourview, x+.5, y+.5); |
692 |
> |
viewray(orig, dir, &ourview, (x+.5)/hresolu, (y+.5)/vresolu); |
693 |
|
outbuf[0] = orig[0]; outbuf[1] = orig[1]; outbuf[2] = orig[2]; |
694 |
|
outbuf[3] = dir[0]; outbuf[4] = dir[1]; outbuf[5] = dir[2]; |
695 |
|
if (fwrite(outbuf, sizeof(float), 6, psend) < 6) |