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

Comparing ray/src/cv/pabopto2bsdf.c (file contents):
Revision 2.34 by greg, Tue Apr 23 17:18:18 2019 UTC vs.
Revision 2.35 by greg, Tue Apr 23 23:48:33 2019 UTC

# Line 191 | Line 191 | add_pabopto_inp(const int i)
191   }
192  
193   #ifndef TEST_MAIN
194 +
195 + #define SYM_ILL         '?'             /* illegal symmetry value */
196 + #define SYM_ISO         'I'             /* isotropic */
197 + #define SYM_QUAD        'Q'             /* quadrilateral symmetry */
198 + #define SYM_BILAT       'B'             /* bilateral symmetry */
199 + #define SYM_ANISO       'A'             /* anisotropic */
200 +
201 + static const char       quadrant_rep[16][16] = {
202 +                                "in-plane","0-90","90-180","0-180",
203 +                                "180-270","0-90+180-270","90-270",
204 +                                "0-270","270-360","270-90",
205 +                                "90-180+270-360","270-180","180-360",
206 +                                "180-90","90-360","0-360"
207 +                        };
208 + static const char       quadrant_sym[16] = {
209 +                                SYM_ISO, SYM_QUAD, SYM_QUAD, SYM_BILAT,
210 +                                SYM_QUAD, SYM_ILL, SYM_BILAT, SYM_ILL,
211 +                                SYM_QUAD, SYM_BILAT, SYM_ILL, SYM_ILL,
212 +                                SYM_BILAT, SYM_ILL, SYM_ILL, SYM_ANISO
213 +                        };
214 +
215   /* Read in PAB-Opto BSDF files and output RBF interpolant */
216   int
217   main(int argc, char *argv[])
218   {
219 <        extern int              nprocs;
220 <        static const char       quadrant_rep[16][16] = {
221 <                                        "iso","0-90","90-180","0-180",
201 <                                        "180-270","0-90+180-270","90-270",
202 <                                        "0-270","270-360","270-90",
203 <                                        "90-180+270-360","270-180","180-360",
204 <                                        "0-90+180-360","90-360","0-360"
205 <                                };
206 <        const char *            symmetry = "Unknown";
207 <        int                     i;
219 >        extern int      nprocs;
220 >        const char      *symmetry = "U";
221 >        int             i;
222                                                  /* start header */
223          SET_FILE_BINARY(stdout);
224          newheader("RADIANCE", stdout);
# Line 247 | Line 261 | main(int argc, char *argv[])
261          make_rbfrep();                          /* process last data set */
262                                                  /* check input symmetry */
263          switch (toupper(symmetry[0])) {
264 <        case 'U':                               /* unknown symmetry */
265 <                if ((inp_coverage == (INP_QUAD1|INP_QUAD3)) |
266 <                                (inp_coverage == (INP_QUAD2|INP_QUAD4)) |
267 <                                (inp_coverage == (INP_QUAD1|INP_QUAD2|INP_QUAD3)) |
268 <                                (inp_coverage == (INP_QUAD2|INP_QUAD3|INP_QUAD4)) |
269 <                                (inp_coverage == (INP_QUAD4|INP_QUAD1|INP_QUAD2)) |
270 <                                (inp_coverage == (INP_QUAD1|INP_QUAD3|INP_QUAD4))) {
271 <                        fprintf(stderr, "%s: unsupported phi coverage (%s)\n",
272 <                                        progname, quadrant_rep[inp_coverage]);
273 <                        return(1);
274 <                }
275 <                break;
276 <        case 'I':                               /* isotropic */
277 <                if (inp_coverage)
278 <                        goto badsymmetry;
279 <                break;
266 <        case 'Q':                               /* quadrilateral symmetry */
267 <                if ((inp_coverage != INP_QUAD1) &
268 <                                (inp_coverage != INP_QUAD2) &
269 <                                (inp_coverage != INP_QUAD3) &
270 <                                (inp_coverage != INP_QUAD4))
271 <                        goto badsymmetry;
272 <                break;
273 <        case 'B':                               /* bilateral symmetry */
274 <                if ((inp_coverage != (INP_QUAD1|INP_QUAD2)) &
275 <                                (inp_coverage != (INP_QUAD2|INP_QUAD3)) &
276 <                                (inp_coverage != (INP_QUAD3|INP_QUAD4)) &
277 <                                (inp_coverage != (INP_QUAD4|INP_QUAD1)))
278 <                        goto badsymmetry;
279 <                break;
280 <        case 'A':                               /* anisotropic */
281 <                if (inp_coverage != (INP_QUAD1|INP_QUAD2|INP_QUAD3|INP_QUAD4))
282 <                        goto badsymmetry;
283 <                break;
264 >        case 'U':                               /* unspecified symmetry */
265 >                if (quadrant_sym[inp_coverage] != SYM_ILL)
266 >                        break;                  /* anything legal goes */
267 >                fprintf(stderr, "%s: unsupported phi coverage (%s)\n",
268 >                                progname, quadrant_rep[inp_coverage]);
269 >                return(1);
270 >        case SYM_ISO:                           /* legal symmetry types */
271 >        case SYM_QUAD:
272 >        case SYM_BILAT:
273 >        case SYM_ANISO:
274 >                if (quadrant_sym[inp_coverage] == toupper(symmetry[0]))
275 >                        break;                  /* matches spec */
276 >                fprintf(stderr,
277 >                "%s: phi coverage (%s) does not match requested '%s' symmetry\n",
278 >                                progname, quadrant_rep[inp_coverage], symmetry);
279 >                return(1);
280          default:
281                  fprintf(stderr,
282    "%s: -s option must be Isotropic, Quadrilateral, Bilateral, or Anisotropic\n",
# Line 288 | Line 284 | main(int argc, char *argv[])
284                  return(1);
285          }
286   #ifdef DEBUG
287 <        fprintf(stderr, "Input phi coverage: %s\n", quadrant_rep[inp_coverage]);
287 >        fprintf(stderr, "Input phi coverage (%s) has '%c' symmetry\n",
288 >                                quadrant_rep[inp_coverage],
289 >                                quadrant_sym[inp_coverage]);
290   #endif
291          build_mesh();                           /* create interpolation */
292          save_bsdf_rep(stdout);                  /* write it out */
293          return(0);
296 badsymmetry:
297        fprintf(stderr, "%s: phi coverage (%s) does not match requested '%s' symmetry\n",
298                        progname, quadrant_rep[inp_coverage], symmetry);
294   userr:
295          fprintf(stderr, "Usage: %s [-t][-n nproc][-s symmetry] meas1.dat meas2.dat .. > bsdf.sir\n",
296                                          progname);
297          return(1);
298   }
299 < #else
299 >
300 > #else           /* TEST_MAIN */
301 >
302   /* Test main produces a Radiance model from the given input file */
303   int
304   main(int argc, char *argv[])
# Line 385 | Line 382 | main(int argc, char *argv[])
382   #endif
383          return(0);
384   }
385 < #endif
385 >
386 > #endif          /* TEST_MAIN */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines