ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/cv/pabopto2xyz.c
(Generate patch)

Comparing ray/src/cv/pabopto2xyz.c (file contents):
Revision 2.1 by greg, Wed Jul 27 18:05:53 2016 UTC vs.
Revision 2.2 by greg, Thu Jul 28 18:21:23 2016 UTC

# Line 43 | Line 43 | extern void            SDdisk2square(double sq[2], double diskx,
43  
44   char                    *progname;      /* global argv[0] */
45  
46 + int                     incident_side = 0;      /* signum(intheta) */
47 + int                     exiting_side = 0;       /* signum(outtheta) */
48 +
49   int                     nprocs = 1;     /* number of processes to run */
50  
51   int                     nchild = 0;     /* number of children (-1 in child) */
# Line 240 | Line 243 | init_pabopto_inp(PGINPUT *pgi, const char *fname)
243                  fputs(": unknown incident angle\n", stderr);
244                  return(0);
245          }
246 +        if (!incident_side) {
247 +                incident_side = (pgi->theta < 90.) ? 1 : -1;
248 +        } else if ((incident_side > 0) ^ (pgi->theta < 90.)) {
249 +                fputs(fname, stderr);
250 +                fputs(": incident on opposite side of surface\n", stderr);
251 +                return(0);
252 +        }
253                                  /* convert angle to grid position */
254          pos_from_ang(pgi->igp, pgi->theta, pgi->phi);
255          return(1);
# Line 280 | Line 290 | load_interp(PGINTERP *pgint, const int igp[2], const P
290                                  if ((pgint->ip2 == NULL) | (pgint->va == NULL))
291                                          goto memerr;
292                          }
293 +                        if (!exiting_side) {
294 +                                exiting_side = (theta < 90.) ? 1 : -1;
295 +                        } else if ((exiting_side > 0) ^ (theta < 90.)) {
296 +                                fputs(pginp->fname, stderr);
297 +                                fputs(": exiting measurement on wrong side\n", stderr);
298 +                                return(0);
299 +                        }
300                          sq_from_ang(sq, theta, phi);
301                          pgint->ip2->spt[nread][0] = sq[0]*ANGRES;
302                          pgint->ip2->spt[nread][1] = sq[1]*ANGRES;
# Line 371 | Line 388 | interp_xyz(const PGINPUT *inp0, int nf, const PGINTERP
388                                  inp0->fname, outfname);
389   #endif
390                  while (fscanf(ifp, "%lf %lf %lf", &theta, &phi, &val[0]) == 3) {
391 +                        if (!exiting_side) {
392 +                                exiting_side = (theta < 90.) ? 1 : -1;
393 +                        } else if ((exiting_side > 0) ^ (theta < 90.)) {
394 +                                fputs(inp0->fname, stderr);
395 +                                fputs(": exiting measurement on wrong side\n", stderr);
396 +                                return(0);
397 +                        }
398                          sq_from_ang(sq, theta, phi);
399                          val[1] = interp2val(int1, sq[0]*ANGRES, sq[1]*ANGRES);
400                          val[2] = interp2val(int2, sq[0]*ANGRES, sq[1]*ANGRES);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines