BRL-CAD
sh_toyota.c
Go to the documentation of this file.
1 /* S H _ T O Y O T A . C
2  * BRL-CAD
3  *
4  * Copyright (c) 1992-2014 United States Government as represented by
5  * the U.S. Army Research Laboratory.
6  *
7  * This library is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU Lesser General Public License
9  * version 2.1 as published by the Free Software Foundation.
10  *
11  * This library is distributed in the hope that it will be useful, but
12  * WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this file; see the file named COPYING for more
18  * information.
19  */
20 /** @file liboptical/sh_toyota.c
21  *
22  * Notes -
23  * Implementation of model developed by Atsushi Takagi, Hitoshi
24  * Takaoka, Tetsuya Oshima, and Yoshinori Ogata described in
25  * the paper "Accurate Rendering Technique Based on Colorimetric
26  * Conception" in "Computer Graphics, Volume 24, Number 4, August
27  * 1990", an ACM SIGGRAPH Publication, pp. 263-72. References
28  * to Toyota in this module refer to that paper.
29  *
30  * The normals on all surfaces point OUT of the solid.
31  * The incoming light rays point IN. Thus the sign change.
32  *
33  */
34 
35 #include "common.h"
36 
37 #include <stddef.h>
38 #include <stdio.h>
39 #include <math.h>
40 #include <string.h>
41 
42 #include "vmath.h"
43 #include "mater.h"
44 #include "raytrace.h"
45 #include "optical.h"
46 #include "plot3.h"
47 #include "light.h"
48 
49 
50 /* Sky onditions for luminance calculations. */
51 #define CLEAR_SKY 0
52 #define MEDIUM_SKY 1
53 #define OVERCAST_SKY 2
54 
55 #define MIKE_TOL .000001
56 
57 
58 /* Local information */
60  fastf_t wavelength; /* Wavelength of light (nm). */
61  fastf_t alpha, beta; /* Coefficients of turbidity. */
62  int weather; /* CLEAR_SKY, MEDIUM_SKY, OVERCAST_SKY */
63  fastf_t sun_sang; /* Solid angle of sun from ground. */
64  fastf_t index_refrac; /* Index of refraction of material. */
65  fastf_t atmos_trans; /* Atmospheric transmittance. */
66  vect_t Zenith; /* Sky zenith. */
67  char material[128]; /* File name of reflectance data. */
68  fastf_t *refl; /* Data read from 'material'. */
69  int refl_lines; /* Lines read from 'material' file. */
70  int glass; /* Boolean, is it glass? */
71 };
72 #define CK_NULL ((struct toyota_specific *)0)
73 #define CL_O(m) bu_offsetof(struct toyota_specific, m)
74 
76  {"%f", 1, "alpha", CL_O(alpha), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
77  {"%f", 1, "beta", CL_O(beta), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
78  {"%d", 1, "weather", CL_O(weather), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
79  {"%f", 1, "sun_sang", CL_O(sun_sang), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
80  {"%f", 1, "index_refrac", CL_O(index_refrac), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
81  {"%f", 1, "atmos_trans", CL_O(atmos_trans), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
82  {"%f", 3, "Zenith", CL_O(Zenith), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
83  {"%s", 1, "material", CL_O(material), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
84  {"%d", 1, "glass", CL_O(glass), BU_STRUCTPARSE_FUNC_NULL, NULL, NULL },
85  {"", 0, (char *)0, 0, BU_STRUCTPARSE_FUNC_NULL, NULL, NULL }
86 };
87 
88 
89 HIDDEN int toyota_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip);
90 HIDDEN int tmirror_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip);
91 HIDDEN int tglass_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip);
92 HIDDEN int toyota_render(register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp);
93 HIDDEN void toyota_print(register struct region *rp, void *dp);
94 HIDDEN void toyota_free(void *cp);
95 
96 void lambda_to_rgb(fastf_t lambda, fastf_t irrad, fastf_t *rgb);
97 void spectral_dist_table(fastf_t lambda, fastf_t *e_mean, fastf_t *v1, fastf_t *v2);
98 
100 fastf_t air_mass(fastf_t in_gamma);
101 fastf_t background_light(fastf_t lambda, struct toyota_specific *ts, fastf_t *Refl, fastf_t *Sun, fastf_t t_vl, struct shadework *swp);
102 fastf_t clear_sky_lum(fastf_t lz, fastf_t *Sky_elmt, fastf_t *Sun, fastf_t *Zenith);
103 fastf_t fresnel_refl(fastf_t cos_eps, fastf_t n1, fastf_t n2);
104 fastf_t homogenous_sky_lum(fastf_t *Sky_elmt, fastf_t *Sun, fastf_t t_vl);
105 fastf_t sun_radiance(fastf_t lambda, fastf_t alpha, fastf_t beta, fastf_t sun_alt, fastf_t sun_sang);
106 fastf_t absorp_coeff(fastf_t lambda, char *material);
107 fastf_t overcast_sky_lum(fastf_t lz, fastf_t *Zenith, fastf_t *Sky_elmt);
109 fastf_t skylight_spectral_dist(fastf_t lambda, fastf_t *Zenith, fastf_t *Sky_elmt, fastf_t *Sun, int weather, fastf_t t_vl);
110 fastf_t zenith_luminance(fastf_t sun_alt, fastf_t t_vl);
111 
112 struct mfuncs toyota_mfuncs[] = {
113  {MF_MAGIC, "toyota", 0, MFI_NORMAL|MFI_LIGHT, 0, toyota_setup, toyota_render, toyota_print, toyota_free },
114  {MF_MAGIC, "tmirror", 0, MFI_NORMAL|MFI_LIGHT, 0, tmirror_setup, toyota_render, toyota_print, toyota_free },
115  {MF_MAGIC, "tglass", 0, MFI_NORMAL|MFI_LIGHT, 0, tglass_setup, toyota_render, toyota_print, toyota_free },
116  {0, (char *)0, 0, 0, 0, 0, 0, 0, 0 }
117 };
118 
119 
120 #define RI_AIR 1.0 /* Refractive index of air. */
121 
122 /**
123  * These should be measured values, but since we're lazy let's use
124  * values Toyota carefully measured in Japan one day.
125  *
126  * Data measured: 11:28am, October 20, 1989 (Friday)
127  *
128  * Location: Toyota-city, Aichi-prefecture, Japan at 35d 2'55.07"
129  * North, 137d 9'45.26" East
130  *
131  * Measuring Instruments: Precision pyrheliometer (Model MS-52 made by
132  * Eko Co., Ltd.), Sun-photo meter (Model MS-110 made by Eko Co.,
133  * Ltd.), Luminance meter (MINOLTA CS-100)
134  */
135 HIDDEN int
136 toyota_setup(register struct region *UNUSED(rp), struct bu_vls *matparm, void **dpp, const struct mfuncs *UNUSED(mfp), struct rt_i *UNUSED(rtip))
137 
138 
139 /* New since 4.4 release */
140 {
141  char mfile[200];
142  double l, a, b;
143  FILE *fp;
144  int i, lines;
145  register struct toyota_specific *tp;
146 
147  BU_CK_VLS(matparm);
148  BU_GET(tp, struct toyota_specific);
149  *dpp = tp;
150 
151  /* Sun was at 44.35 degrees above horizon. */
152  tp->alpha = 0.957; /* coefficients of turbidity (aerosol */
153  tp->beta = 0.113; /* optical depth) */
154  tp->atmos_trans = 0.772;/* atmospheric transmittance */
155  tp->weather = CLEAR_SKY;/* no clouds */
156 
157  /* / M_2PI / arctan(rs/d)
158  * sun_sang = | |
159  * | | sin(theta) d-theta d-phi
160  * / /
161  *
162  * = M_2PI*(1 - cos(arctan(rs/d)))
163  *
164  * = M_2PI*(1 - cos(arctan(695300/149000000)))
165  *
166  * = M_2PI*(1 - cos(.00466640908179121739))
167  *
168  * = M_2PI*(1 - .99998911233289762807)
169  *
170  * = .00006840922996708585320208283043854326275346156491
171  *
172  * where rs = radius of the sun (km),
173  * d = distance from earth to sun (km).
174  *
175  * (This term is cancelled out in calculations it turns out.)
176  */
177  tp->sun_sang = 6.840922996708585e-5; /* in steradians */
178  tp->index_refrac = 1.2;
179  bu_strlcpy(tp->material, "junk", sizeof(tp->material));
180  VSET(tp->Zenith, 0., 0., 1.0);
181 
182  if (bu_struct_parse(matparm, toyota_parse, (char *)tp, NULL) < 0) {
183  BU_PUT(tp, struct toyota_specific);
184  return -1;
185  }
186 
187  /* Read in reflectance data. */
188  bu_strlcpy(mfile, tp->material, sizeof(mfile));
189  if ((fp = fopen(mfile, "rb")) == NULL) {
190  perror(mfile);
191  bu_log("reflectance: cannot open %s for reading.", mfile);
192  bu_bomb("");
193  }
194  if (fscanf(fp, "%d", &lines) != 1) {
195  bu_log("toyota_setup: no data in %s\n", mfile);
196  bu_bomb("");
197  }
198  tp->refl_lines = lines;
199  tp->refl = (fastf_t *)bu_malloc(sizeof(fastf_t)*lines*3, "refl[]");
200  i = 0;
201  while (fscanf(fp, "%lf %lf %lf", &l, &a, &b) == 3 && i < lines*3) {
202  tp->refl[i] = l;
203  tp->refl[i+1] = a;
204  tp->refl[i+2] = b;
205  i += 3;
206  }
207  fclose(fp);
208 
209  if (bu_strncmp("glass", tp->material, 5) == 0) {
210  tp->glass = 1;
211  } else if (tp->material[0] == '/') {
212  char *cp = strrchr(tp->material, '/')+1;
213  if (bu_strncmp("glass", cp, 5) == 0)
214  tp->glass = 1;
215  } else {
216  tp->glass = 0;
217  }
218  return 1;
219 }
220 
221 
222 HIDDEN int
223 tmirror_setup(register struct region *UNUSED(rp), struct bu_vls *matparm, void **dpp, const struct mfuncs *UNUSED(mfp), struct rt_i *UNUSED(rtip))
224 
225 
226 /* New since 4.4 release */
227 {
228  register struct toyota_specific *pp;
229 
230  BU_CK_VLS(matparm);
231  BU_GET(pp, struct toyota_specific);
232  *dpp = pp;
233 
234  /* use function, fn(lambda), describing spectral */
235  /* reflectance of mirror */
236 
237  return 1;
238 }
239 
240 
241 HIDDEN int
242 tglass_setup(register struct region *UNUSED(rp), struct bu_vls *matparm, void **dpp, const struct mfuncs *UNUSED(mfp), struct rt_i *UNUSED(rtip))
243 
244 
245 /* New since 4.4 release */
246 {
247  register struct toyota_specific *pp;
248 
249  BU_CK_VLS(matparm);
250  BU_GET(pp, struct toyota_specific);
251  *dpp = pp;
252 
253  /* use function, fn(lambda), describing spectral */
254  /* reflectance of glass */
255 
256  return 1;
257 }
258 
259 
260 HIDDEN void
261 toyota_print(register struct region *rp, void *dp)
262 {
263  bu_struct_print(rp->reg_name, toyota_parse, (char *)dp);
264 }
265 
266 
267 HIDDEN void
268 toyota_free(void *cp)
269 {
270  /* need to free cp->refl */
271  BU_PUT(cp, struct toyota_specific);
272 }
273 
274 
275 /**
276  * Return the relative optical air mass as a function of solar
277  * altitude. See Kasten, Fritz "Archiv fuer Meterologie Geophysik
278  * und Bioklimateorie, Ser. B", Vol. 14, p. 14, 1966, A New Table and
279  * Approximation Formula for the Relative Optical Air Mass.
280  *
281  * Unitless (ratio).
282  */
283 fastf_t
284 air_mass(fastf_t air_gamma)
285 /* Solar altitude off horizon (degrees). */
286 {
287  if (air_gamma <= 0.0) {
288  bu_log("air_mass: sun altitude of %g degrees ignored.\n", air_gamma);
289  return 0;
290  }
291  return 1.0/(sin(air_gamma*DEG2RAD) + 0.1500*pow((air_gamma + 3.885), -1.253));
292 }
293 
294 
295 /**
296  * Return sky luminance at its zenith.
297  *
298  * DON'T KNOW HOW TO DO THIS YET!!!
299  * SENT LETTER TO CIE & TOYOTA JULY 7, 1992
300  *
301  * Luminance units: cd/m^2
302  */
303 fastf_t
305 /* Solar altitude off horizon (degrees). */
306 /* atmospheric turbidity (aerosol optical depth) */
307 {
308  return 2000.0; /* swag */
309 }
310 
311 
312 /**
313  * CIE Standard sky luminance function. Sky covered with clouds
314  * so thick that the sun cannot be seen.
315  * Luminance units: cd/m^2
316  *
317  * Taken from "Continuous Tone Representation of Three-Dimensional
318  * Objects Illuminated by Sky Light" in "Computer Graphics, Volume 20,
319  * Number 4, August 1986, pp. 127-8."
320  */
321 fastf_t
322 overcast_sky_lum(fastf_t lz, fastf_t *Zenith, fastf_t *Sky_elmt)
323 /* luminance of the zenith */
324 /* vectors to zenith and a sky element */
325 {
326  return lz * (1.0 + 2.*VDOT(Zenith, Sky_elmt)/3.0);
327 }
328 
329 
330 /**
331  * Intermediate homogeneous sky light luminance function. Sky in
332  * which weather homogeneously changes between clear and overcast
333  * skies without clouds scattered in the sky. Luminance units: cd/m^2
334  *
335  * DON'T KNOW HOW TO DO THIS YET!!!
336  * SENT LETTER TO CIE & TOYOTA JULY 7, 1992
337  */
338 fastf_t
340 /* vectors to a sky element and to sun */
341 /* Turbidity factor. */
342 {
343  return 0.0;
344 }
345 
346 
347 /**
348  * CIE Standard sky luminance function. Sky free from clouds.
349  * Luminance units: cd/m^2
350  *
351  * Taken from "Continuous Tone Representation of Three-Dimensional
352  * Objects Illuminated by Sky Light" in "Computer Graphics, Volume 20,
353  * Number 4, August 1986, pp. 127-8."
354  */
355 fastf_t
356 clear_sky_lum(fastf_t lz, fastf_t *Sky_elmt, fastf_t *Sun, fastf_t *Zenith)
357 /* luminance of the zenith */
358 /* vectors to a sky element and to sun */
359 /* vector to zenith */
360 {
361  fastf_t cos_gamma; /* cos(gamma) */
362  fastf_t cos_z0; /* cos(z0) */
363  fastf_t cos_theta; /* cos of angle between zenith & sky element */
364  fastf_t sky_gamma; /* angle from sun to a sky element */
365  fastf_t lum; /* luminance */
366  fastf_t z0; /* angle from zenith to the sun */
367 
368  cos_gamma = VDOT(Sun, Sky_elmt);
369  cos_theta = VDOT(Sky_elmt, Zenith);
370  cos_z0 = VDOT(Zenith, Sun);
371  z0 = acos(cos_z0);
372  sky_gamma = acos(cos_gamma);
373 
374  lum =
375  lz
376  * (0.91 + 10*exp(-3.*sky_gamma) + 0.45*cos_gamma*cos_gamma)
377  * (1.0 - exp(-0.32/cos_theta))
378  / 0.27385*(0.91 + 10.*exp(-3.*z0) + 0.45*cos_z0*cos_z0);
379 
380  return lum;
381 }
382 
383 
384 /**
385  * Table of solar irradiance values taken from WMO - No. 590,
386  * "Commission for Instruments and Methods of Observation", Abridged
387  * Final Report of the Eighth Session, Mexico City, 19-30 October
388  * 1981, pp. 71-5.
389  *
390  * Return the solar spectral irradiance through the atmosphere for a
391  * given wavelength of light. Units: W/m^2
392  */
393 fastf_t
395 {
396 #define NSIRRAD 992 /* Number of entries in solar irradiance table. */
397 
398  fastf_t irrad;
399  fastf_t ratio;
400  int hi, j, lo;
401  /* Table row: wavelength, solar irradiance. */
402  static fastf_t table[NSIRRAD][2] = {
403  {25000.00, .72506},
404  {10000.00, .02389},
405  {9900.00, .02479},
406  {9800.00, .02589},
407  {9700.00, .02689},
408  {9600.00, .02814},
409  {9500.00, .02904},
410  {9400.00, .02959},
411  {9300.00, .03085},
412  {9200.00, .03275},
413  {9100.00, .03475},
414  {9000.00, .03650},
415  {8900.00, .03816},
416  {8800.00, .03986},
417  {8700.00, .04111},
418  {8600.00, .04266},
419  {8500.00, .04477},
420  {8400.00, .04697},
421  {8300.00, .04917},
422  {8200.00, .05243},
423  {8100.00, .05443},
424  {8000.00, .05723},
425  {7900.00, .06014},
426  {7800.00, .06344},
427  {7700.00, .06590},
428  {7600.00, .06975},
429  {7500.00, .07411},
430  {7400.00, .07746},
431  {7300.00, .08157},
432  {7200.00, .08668},
433  {7100.00, .09138},
434  {7000.00, .09659},
435  {6900.00, .10160},
436  {6800.00, .10846},
437  {6700.00, .11432},
438  {6600.00, .12158},
439  {6500.00, .12899},
440  {6400.00, .13690},
441  {6300.00, .14596},
442  {6200.00, .15553},
443  {6100.00, .16529},
444  {6000.00, .17641},
445  {5900.00, .18843},
446  {5800.00, .20140},
447  {5700.00, .21577},
448  {5600.00, .23119},
449  {5500.00, .24821},
450  {5400.00, .26694},
451  {5300.00, .28697},
452  {5200.00, .30925},
453  {5100.00, .33374},
454  {5000.00, .06965},
455  {4980.00, .07055},
456  {4960.00, .07186},
457  {4940.00, .07296},
458  {4920.00, .07431},
459  {4900.00, .07556},
460  {4800.00, .07671},
461  {4860.00, .07801},
462  {4840.00, .07947},
463  {4820.00, .08077},
464  {4800.00, .08222},
465  {4780.00, .08357},
466  {4760.00, .08512},
467  {4740.00, .08653},
468  {4720.00, .08798},
469  {4700.00, .08958},
470  {4680.00, .09113},
471  {4660.00, .09279},
472  {4640.00, .09444},
473  {4620.00, .09624},
474  {4600.00, .09784},
475  {4580.00, .09965},
476  {4560.00, .10150},
477  {4540.00, .10330},
478  {4520.00, .10525},
479  {4500.00, .10721},
480  {4480.00, .10921},
481  {4460.00, .11116},
482  {4440.00, .11322},
483  {4420.00, .11547},
484  {4400.00, .11762},
485  {4380.00, .11978},
486  {4360.00, .12213},
487  {4340.00, .12448},
488  {4320.00, .12679},
489  {4300.00, .12924},
490  {4280.00, .13174},
491  {4260.00, .13430},
492  {4240.00, .13695},
493  {4220.00, .13950},
494  {4200.00, .14231},
495  {4180.00, .14526},
496  {4160.00, .14807},
497  {4140.00, .15107},
498  {4120.00, .15403},
499  {4100.00, .15718},
500  {4080.00, .16039},
501  {4060.00, .16364},
502  {4040.00, .16700},
503  {4020.00, .17060},
504  {4000.00, .17376},
505  {3980.00, .17686},
506  {3960.00, .18026},
507  {3940.00, .18357},
508  {3920.00, .18707},
509  {3900.00, .19053},
510  {3880.00, .19424},
511  {3860.00, .19804},
512  {3840.00, .20175},
513  {3820.00, .20575},
514  {3800.00, .20976},
515  {3780.00, .21391},
516  {3760.00, .21817},
517  {3740.00, .22243},
518  {3720.00, .22693},
519  {3700.00, .23139},
520  {3680.00, .23610},
521  {3660.00, .24080},
522  {3640.00, .24591},
523  {3620.00, .25067},
524  {3600.00, .25593},
525  {3580.00, .26133},
526  {3560.00, .26654},
527  {3540.00, .27220},
528  {3520.00, .27796},
529  {3500.00, .28387},
530  {3480.00, .29003},
531  {3460.00, .29623},
532  {3440.00, .30264},
533  {3420.00, .30920},
534  {3400.00, .31586},
535  {3380.00, .32282},
536  {3360.00, .33003},
537  {3340.00, .33745},
538  {3320.00, .34496},
539  {3300.00, .35277},
540  {3280.00, .36063},
541  {3260.00, .36894},
542  {3240.00, .37735},
543  {3220.00, .38612},
544  {3200.00, .39528},
545  {3180.00, .40454},
546  {3160.00, .41401},
547  {3140.00, .42377},
548  {3120.00, .43384},
549  {3100.00, .44415},
550  {3080.00, .45502},
551  {3060.00, .46598},
552  {3040.00, .47740},
553  {3020.00, .48922},
554  {3000.00, .50144},
555  {2980.00, .51398},
556  {2960.00, .52680},
557  {2940.00, .54014},
558  {2920.00, .55401},
559  {2900.00, .56821},
560  {2880.00, .58281},
561  {2860.00, .59805},
562  {2840.00, .61378},
563  {2820.00, .63002},
564  {2800.00, .64675},
565  {2780.00, .66405},
566  {2760.00, .68188},
567  {2740.00, .70035},
568  {2720.00, .71951},
569  {2700.00, .73934},
570  {2680.00, .75994},
571  {2660.00, .78120},
572  {2640.00, .80325},
573  {2620.00, .82621},
574  {2600.00, .84980},
575  {2580.00, .87431},
576  {2560.00, .89997},
577  {2540.00, .92633},
578  {2520.00, .95377},
579  {2500.00, .98254},
580  {2480.00, 1.01619},
581  {2460.00, .99909},
582  {2440.00, 1.09984},
583  {2420.00, 1.09744},
584  {2400.00, 1.15632},
585  {2380.00, 1.19330},
586  {2360.00, 1.22515},
587  {2340.00, 1.12220},
588  {2320.00, 1.21063},
589  {2300.00, 1.31874},
590  {2280.00, 1.35071},
591  {2260.00, 1.44179},
592  {2240.00, 1.42464},
593  {2220.00, 1.52048},
594  {2200.00, 1.46643},
595  {2180.00, 1.59920},
596  {2160.00, 1.65085},
597  {2140.00, 1.74686},
598  {2120.00, 1.80843},
599  {2100.00, 1.90680},
600  {2080.00, 1.97332},
601  {2060.00, 2.09129},
602  {2040.00, 2.20196},
603  {2020.00, 2.25371},
604  {2000.00, .59725},
605  {1995.00, .60954},
606  {1990.00, .60954},
607  {1985.00, .61938},
608  {1980.00, .63661},
609  {1975.00, .63663},
610  {1970.00, .62682},
611  {1965.00, .62930},
612  {1960.00, .61948},
613  {1955.00, .62191},
614  {1950.00, .63663},
615  {1945.00, .64402},
616  {1940.00, .65388},
617  {1935.00, .66127},
618  {1930.00, .66372},
619  {1925.00, .66866},
620  {1920.00, .67852},
621  {1915.00, .68836},
622  {1910.00, .68836},
623  {1905.00, .67607},
624  {1900.00, .68097},
625  {1895.00, .69081},
626  {1890.00, .69084},
627  {1885.00, .69825},
628  {1880.00, .69089},
629  {1875.00, .67860},
630  {1870.00, .69827},
631  {1865.00, .71795},
632  {1860.00, .72289},
633  {1855.00, .73520},
634  {1850.00, .74995},
635  {1845.00, .76222},
636  {1840.00, .75977},
637  {1835.00, .76718},
638  {1830.00, .78195},
639  {1825.00, .78933},
640  {1820.00, .79920},
641  {1815.00, .80168},
642  {1810.00, .82136},
643  {1805.00, .84351},
644  {1800.00, .85581},
645  {1795.00, .85581},
646  {1790.00, .84847},
647  {1785.00, .85340},
648  {1780.00, .86076},
649  {1775.00, .87554},
650  {1770.00, .90015},
651  {1765.00, .91983},
652  {1760.00, .93708},
653  {1755.00, .94446},
654  {1750.00, .93462},
655  {1745.00, .94451},
656  {1740.00, .95438},
657  {1735.00, .95192},
658  {1730.00, .96915},
659  {1725.00, 1.00603},
660  {1720.00, 1.04541},
661  {1715.00, 1.04050},
662  {1710.00, 1.04053},
663  {1705.00, 1.07498},
664  {1700.00, 1.07989},
665  {1695.00, 1.08482},
666  {1690.00, 1.09711},
667  {1685.00, 1.10207},
668  {1680.00, 1.10455},
669  {1675.00, 1.12177},
670  {1670.00, 1.14395},
671  {1665.00, 1.15627},
672  {1660.00, 1.16859},
673  {1655.00, 1.17107},
674  {1650.00, 1.17355},
675  {1645.00, 1.17357},
676  {1640.00, 1.18096},
677  {1635.00, 1.20064},
678  {1630.00, 1.21786},
679  {1625.00, 1.21543},
680  {1620.00, 1.21298},
681  {1615.00, 1.22282},
682  {1610.00, 1.22039},
683  {1605.00, 1.22780},
684  {1600.00, 1.23789},
685  {1595.00, 1.23369},
686  {1590.00, 1.24698},
687  {1585.00, 1.27011},
688  {1580.00, 1.28837},
689  {1575.00, 1.30169},
690  {1570.00, 1.31253},
691  {1565.00, 1.33581},
692  {1560.00, 1.35664},
693  {1555.00, 1.36510},
694  {1550.00, 1.37111},
695  {1545.00, 1.37710},
696  {1540.00, 1.37815},
697  {1535.00, 1.39415},
698  {1530.00, 1.43248},
699  {1525.00, 1.44347},
700  {1520.00, 1.44457},
701  {1515.00, 1.45564},
702  {1510.00, 1.46670},
703  {1505.00, 1.48030},
704  {1500.00, 1.49392},
705  {1495.00, 1.51255},
706  {1490.00, 1.50869},
707  {1485.00, 1.50731},
708  {1480.00, 1.52847},
709  {1475.00, 1.54965},
710  {1470.00, 1.56084},
711  {1465.00, 1.57459},
712  {1460.00, 1.56319},
713  {1455.00, 1.57949},
714  {1450.00, 1.60836},
715  {1445.00, 1.61710},
716  {1440.00, 1.64852},
717  {1435.00, 1.67501},
718  {1430.00, 1.71667},
719  {1425.00, 1.73057},
720  {1420.00, 1.72175},
721  {1415.00, 1.73062},
722  {1410.00, 1.74454},
723  {1405.00, 1.76101},
724  {1400.00, 1.78009},
725  {1395.00, 1.79413},
726  {1390.00, 1.81071},
727  {1385.00, 1.82473},
728  {1380.00, 1.83622},
729  {1375.00, 1.84776},
730  {1370.00, 1.85167},
731  {1365.00, 1.87598},
732  {1360.00, 1.90545},
733  {1355.00, 1.92728},
734  {1350.00, 1.95935},
735  {1345.00, 1.98637},
736  {1340.00, 2.00061},
737  {1335.00, 2.01744},
738  {1330.00, 2.04455},
739  {1325.00, 2.07422},
740  {1320.00, 2.08599},
741  {1315.00, 2.09267},
742  {1310.00, 2.12504},
743  {1305.00, 2.17289},
744  {1300.00, 2.19728},
745  {1295.00, 2.20817},
746  {1290.00, 2.20586},
747  {1285.00, 2.18811},
748  {1280.00, 2.22702},
749  {1275.00, 2.23501},
750  {1270.00, 2.19665},
751  {1265.00, 2.20982},
752  {1260.00, 2.27449},
753  {1255.00, 2.34947},
754  {1250.00, 2.35491},
755  {1245.00, 2.36347},
756  {1240.00, 2.39271},
757  {1235.00, 2.40869},
758  {1230.00, 2.41800},
759  {1225.00, 2.41267},
760  {1220.00, 2.46066},
761  {1215.00, 2.48077},
762  {1210.00, 2.46524},
763  {1205.00, 2.48264},
764  {1200.00, 2.50255},
765  {1195.00, 2.54010},
766  {1190.00, 2.56496},
767  {1185.00, 2.57288},
768  {1180.00, 2.60708},
769  {1175.00, 2.65420},
770  {1170.00, 2.66601},
771  {1165.00, 2.68286},
772  {1160.00, 2.74250},
773  {1155.00, 2.75429},
774  {1150.00, 2.75855},
775  {1145.00, 2.79045},
776  {1140.00, 2.80977},
777  {1135.00, 2.83161},
778  {1130.00, 2.84585},
779  {1125.00, 2.87770},
780  {1120.00, 2.92710},
781  {1115.00, 2.98648},
782  {1110.00, 3.01826},
783  {1105.00, 3.03248},
784  {1100.00, 3.02659},
785  {1095.00, 3.03573},
786  {1090.00, 3.07248},
787  {1085.00, 3.09417},
788  {1080.00, 3.13585},
789  {1075.00, 3.17982},
790  {1070.00, 3.21144},
791  {1065.00, 3.22118},
792  {1060.00, 3.23810},
793  {1055.00, 3.28527},
794  {1050.00, 3.37350},
795  {1045.00, 3.42433},
796  {1040.00, 3.44123},
797  {1035.00, 3.45900},
798  {1030.00, 3.49964},
799  {1025.00, 3.53842},
800  {1020.00, 3.57139},
801  {1015.00, 3.64688},
802  {1010.00, 3.68679},
803  {1005.00, 3.71518},
804  {1000.00, 3.72852},
805  {995.00, 3.79626},
806  {990.00, 3.81926},
807  {985.00, 3.84833},
808  {980.00, 3.84504},
809  {975.00, 3.80245},
810  {970.00, 3.84045},
811  {965.00, 3.83984},
812  {960.00, 3.86656},
813  {955.00, 3.85118},
814  {950.00, 3.92912},
815  {945.00, 3.97737},
816  {940.00, 4.03069},
817  {935.00, 4.13721},
818  {930.00, 4.15959},
819  {925.00, 4.13519},
820  {920.00, 4.27664},
821  {915.00, 4.36772},
822  {910.00, 4.38679},
823  {905.00, 4.51286},
824  {900.00, 4.61964},
825  {895.00, 4.69612},
826  {890.00, 4.75038},
827  {885.00, 4.79674},
828  {880.00, 4.85967},
829  {875.00, 4.91975},
830  {870.00, 4.80462},
831  {865.00, 4.95842},
832  {860.00, 5.06243},
833  {855.00, 4.82633},
834  {850.00, 5.10683},
835  {845.00, 5.08209},
836  {840.00, 5.12503},
837  {835.00, 5.15348},
838  {830.00, 5.25912},
839  {825.00, 5.30549},
840  {820.00, 5.38867},
841  {815.00, 5.52502},
842  {810.00, 5.61305},
843  {805.00, 5.72199},
844  {800.00, 1.14525},
845  {799.00, 1.14639},
846  {798.00, 1.15026},
847  {797.00, 1.15517},
848  {796.00, 1.15412},
849  {795.00, 1.17566},
850  {794.00, 1.15308},
851  {793.00, 1.11129},
852  {792.00, 1.13051},
853  {791.00, 1.13666},
854  {790.00, 1.14973},
855  {789.00, 1.15286},
856  {788.00, 1.16280},
857  {787.00, 1.16576},
858  {786.00, 1.17273},
859  {785.00, 1.17720},
860  {784.00, 1.17970},
861  {783.00, 1.17325},
862  {782.00, 1.18221},
863  {781.00, 1.19437},
864  {780.00, 1.19116},
865  {779.00, 1.20813},
866  {778.00, 1.18794},
867  {777.00, 1.14998},
868  {776.00, 1.16775},
869  {775.00, 1.18614},
870  {774.00, 1.18553},
871  {773.00, 1.17829},
872  {772.00, 1.18492},
873  {771.00, 1.18526},
874  {770.00, 1.19155},
875  {769.00, 1.18482},
876  {768.00, 1.19784},
877  {767.00, 1.20924},
878  {766.00, 1.21086},
879  {765.00, 1.19780},
880  {764.00, 1.21247},
881  {763.00, 1.23097},
882  {762.00, 1.22714},
883  {761.00, 1.20968},
884  {760.00, 1.22332},
885  {759.00, 1.22675},
886  {758.00, 1.23696},
887  {757.00, 1.23914},
888  {756.00, 1.24716},
889  {755.00, 1.25022},
890  {754.00, 1.25518},
891  {753.00, 1.24331},
892  {752.00, 1.26015},
893  {751.00, 1.26451},
894  {750.00, 1.27698},
895  {749.00, 1.28908},
896  {748.00, 1.28946},
897  {747.00, 1.28650},
898  {746.00, 1.28984},
899  {745.00, 1.29302},
900  {744.00, 1.29319},
901  {743.00, 1.27635},
902  {742.00, 1.29336},
903  {741.00, 1.29234},
904  {740.00, 1.31036},
905  {739.00, 1.29629},
906  {738.00, 1.32839},
907  {737.00, 1.36420},
908  {736.00, 1.36049},
909  {735.00, 1.35433},
910  {734.00, 1.35677},
911  {733.00, 1.35552},
912  {732.00, 1.35922},
913  {731.00, 1.36585},
914  {730.00, 1.36291},
915  {729.00, 1.33668},
916  {728.00, 1.35997},
917  {727.00, 1.37247},
918  {726.00, 1.38325},
919  {725.00, 1.40749},
920  {724.00, 1.39403},
921  {723.00, 1.41306},
922  {722.00, 1.38057},
923  {721.00, 1.32661},
924  {720.00, 1.34807},
925  {719.00, 1.36114},
926  {718.00, 1.36953},
927  {717.00, 1.36779},
928  {716.00, 1.37792},
929  {715.00, 1.37511},
930  {714.00, 1.38806},
931  {713.00, 1.39009},
932  {712.00, 1.40101},
933  {711.00, 1.44352},
934  {710.00, 1.41192},
935  {709.00, 1.36238},
936  {708.00, 1.38033},
937  {707.00, 1.37736},
938  {706.00, 1.39827},
939  {705.00, 1.42790},
940  {704.00, 1.41918},
941  {703.00, 1.39298},
942  {702.00, 1.41241},
943  {701.00, 1.42990},
944  {700.00, 1.40560},
945  {699.00, 1.46310},
946  {698.00, 1.47849},
947  {697.00, 1.43771},
948  {696.00, 1.45109},
949  {695.00, 1.46484},
950  {694.00, 1.43486},
951  {693.00, 1.41952},
952  {692.00, 1.41664},
953  {691.00, 1.44080},
954  {690.00, 1.41801},
955  {689.00, 1.38104},
956  {688.00, 1.37581},
957  {687.00, 1.41410},
958  {686.00, 1.44913},
959  {685.00, 1.44300},
960  {684.00, 1.46830},
961  {683.00, 1.46116},
962  {682.00, 1.46852},
963  {681.00, 1.48219},
964  {680.00, 1.47857},
965  {679.00, 1.46307},
966  {678.00, 1.50134},
967  {677.00, 1.47300},
968  {676.00, 1.49683},
969  {675.00, 1.53461},
970  {674.00, 1.48491},
971  {673.00, 1.44037},
972  {672.00, 1.47113},
973  {671.00, 1.51041},
974  {670.00, 1.52216},
975  {669.00, 1.51527},
976  {668.00, 1.54030},
977  {667.00, 1.52621},
978  {666.00, 1.57673},
979  {665.00, 1.55345},
980  {664.00, 1.58544},
981  {663.00, 1.57047},
982  {662.00, 1.57889},
983  {661.00, 1.57011},
984  {660.00, 1.53724},
985  {659.00, 1.53194},
986  {658.00, 1.49228},
987  {657.00, 1.32164},
988  {656.00, 1.42139},
989  {655.00, 1.54562},
990  {654.00, 1.62637},
991  {653.00, 1.57986},
992  {652.00, 1.61729},
993  {651.00, 1.63040},
994  {650.00, 1.53595},
995  {649.00, 1.60642},
996  {648.00, 1.60444},
997  {647.00, 1.59691},
998  {646.00, 1.63982},
999  {645.00, 1.62074},
1000  {644.00, 1.62888},
1001  {643.00, 1.64789},
1002  {642.00, 1.59696},
1003  {641.00, 1.58633},
1004  {640.00, 1.63895},
1005  {639.00, 1.67531},
1006  {638.00, 1.64694},
1007  {637.00, 1.67149},
1008  {636.00, 1.64827},
1009  {635.00, 1.67492},
1010  {634.00, 1.62610},
1011  {633.00, 1.70191},
1012  {632.00, 1.62718},
1013  {631.00, 1.60537},
1014  {630.00, 1.65151},
1015  {629.00, 1.67118},
1016  {628.00, 1.69006},
1017  {627.00, 1.71263},
1018  {626.00, 1.62812},
1019  {625.00, 1.61401},
1020  {624.00, 1.68983},
1021  {623.00, 1.68857},
1022  {622.00, 1.68940},
1023  {621.00, 1.67615},
1024  {620.00, 1.75682},
1025  {619.00, 1.73019},
1026  {618.00, 1.71626},
1027  {617.00, 1.64209},
1028  {616.00, 1.69330},
1029  {615.00, 1.73164},
1030  {614.00, 1.68130},
1031  {613.00, 1.73872},
1032  {612.00, 1.72727},
1033  {611.00, 1.74206},
1034  {610.00, 1.72421},
1035  {609.00, 1.66239},
1036  {608.00, 1.78557},
1037  {607.00, 1.73555},
1038  {606.00, 1.74974},
1039  {605.00, 1.71831},
1040  {604.00, 1.80630},
1041  {603.00, 1.74145},
1042  {602.00, 1.69186},
1043  {601.00, 1.75060},
1044  {600.00, 1.71290},
1045  {599.00, 1.72688},
1046  {598.00, 1.75866},
1047  {597.00, 1.83835},
1048  {596.00, 1.76154},
1049  {595.00, 1.80773},
1050  {594.00, 1.76196},
1051  {593.00, 1.77442},
1052  {592.00, 1.79407},
1053  {591.00, 1.82231},
1054  {590.00, 1.60829},
1055  {589.00, 1.73918},
1056  {588.00, 1.81230},
1057  {587.00, 1.79763},
1058  {586.00, 1.77402},
1059  {585.00, 1.84529},
1060  {584.00, 1.84870},
1061  {583.00, 1.84148},
1062  {582.00, 1.86959},
1063  {581.00, 1.84871},
1064  {580.00, 1.81983},
1065  {579.00, 1.82467},
1066  {578.00, 1.77838},
1067  {577.00, 1.83666},
1068  {576.00, 1.87205},
1069  {575.00, 1.85126},
1070  {574.00, 1.83439},
1071  {573.00, 1.91009},
1072  {572.00, 1.81549},
1073  {571.00, 1.75498},
1074  {570.00, 1.88340},
1075  {569.00, 1.81645},
1076  {568.00, 1.85804},
1077  {567.00, 1.84184},
1078  {566.00, 1.82646},
1079  {565.00, 1.84641},
1080  {564.00, 1.87654},
1081  {563.00, 1.88301},
1082  {562.00, 1.82558},
1083  {561.00, 1.86677},
1084  {560.00, 1.85019},
1085  {559.00, 1.82068},
1086  {558.00, 1.82223},
1087  {557.00, 1.84785},
1088  {556.00, 1.91617},
1089  {555.00, 1.90149},
1090  {554.00, 1.92922},
1091  {553.00, 1.84554},
1092  {552.00, 1.90498},
1093  {551.00, 1.86042},
1094  {550.00, 1.93179},
1095  {549.00, 1.90540},
1096  {548.00, 1.84846},
1097  {547.00, 1.91547},
1098  {546.00, 1.87116},
1099  {545.00, 1.93473},
1100  {544.00, 1.88832},
1101  {543.00, 1.89407},
1102  {542.00, 1.85358},
1103  {541.00, 1.81955},
1104  {540.00, 1.83170},
1105  {539.00, 1.93188},
1106  {538.00, 1.91722},
1107  {537.00, 1.88985},
1108  {536.00, 2.01246},
1109  {535.00, 1.90310},
1110  {534.00, 1.91707},
1111  {533.00, 1.83936},
1112  {532.00, 1.95080},
1113  {531.00, 2.00163},
1114  {530.00, 1.90818},
1115  {529.00, 1.93233},
1116  {528.00, 1.85343},
1117  {527.00, 1.70982},
1118  {526.00, 1.92169},
1119  {525.00, 1.95513},
1120  {524.00, 1.93306},
1121  {523.00, 1.90316},
1122  {522.00, 1.88478},
1123  {521.00, 1.87583},
1124  {520.00, 1.80397},
1125  {519.00, 1.65066},
1126  {518.00, 1.75840},
1127  {517.00, 1.63891},
1128  {516.00, 1.90975},
1129  {515.00, 1.85825},
1130  {514.00, 1.87383},
1131  {513.00, 1.86534},
1132  {512.00, 1.98578},
1133  {511.00, 1.94355},
1134  {510.00, 1.95217},
1135  {509.00, 1.92814},
1136  {508.00, 1.91922},
1137  {507.00, 1.93144},
1138  {506.00, 2.00576},
1139  {505.00, 1.92417},
1140  {504.00, 1.89776},
1141  {503.00, 1.93792},
1142  {502.00, 1.81978},
1143  {501.00, 1.81488},
1144  {500.00, 1.93810},
1145  {499.00, 1.88115},
1146  {498.00, 2.01008},
1147  {497.00, 1.96528},
1148  {496.00, 1.88415},
1149  {495.00, 2.06915},
1150  {494.00, 1.97487},
1151  {493.00, 1.86509},
1152  {492.00, 1.82987},
1153  {491.00, 1.97188},
1154  {490.00, 2.01005},
1155  {489.00, 1.86863},
1156  {488.00, 1.88769},
1157  {487.00, 1.65586},
1158  {486.00, 1.82825},
1159  {485.00, 2.00517},
1160  {484.00, 2.00703},
1161  {483.00, 2.00383},
1162  {482.00, 2.07663},
1163  {481.00, 2.02201},
1164  {480.00, 2.09844},
1165  {479.00, 2.02674},
1166  {478.00, 2.05672},
1167  {477.00, 1.97211},
1168  {476.00, 2.00328},
1169  {475.00, 2.03169},
1170  {474.00, 2.00207},
1171  {473.00, 2.03415},
1172  {472.00, 2.00717},
1173  {471.00, 1.89753},
1174  {470.00, 2.00753},
1175  {469.00, 2.01253},
1176  {468.00, 1.99016},
1177  {467.00, 1.92453},
1178  {466.00, 1.99046},
1179  {465.00, 1.96616},
1180  {464.00, 2.05647},
1181  {463.00, 2.11132},
1182  {462.00, 2.09523},
1183  {461.00, 2.05107},
1184  {460.00, 1.99193},
1185  {459.00, 1.98629},
1186  {458.00, 2.05302},
1187  {457.00, 2.07690},
1188  {456.00, 2.03659},
1189  {455.00, 2.02841},
1190  {454.00, 1.96426},
1191  {453.00, 1.92493},
1192  {452.00, 2.14598},
1193  {451.00, 2.22018},
1194  {450.00, 2.02552},
1195  {449.00, 2.00552},
1196  {448.00, 1.99823},
1197  {447.00, 1.92336},
1198  {446.00, 1.81465},
1199  {445.00, 1.97037},
1200  {444.00, 1.92663},
1201  {443.00, 1.97709},
1202  {442.00, 1.90977},
1203  {441.00, 1.72818},
1204  {440.00, 1.78344},
1205  {439.00, 1.60128},
1206  {438.00, 1.75646},
1207  {437.00, 1.94545},
1208  {436.00, 1.83281},
1209  {435.00, 1.70941},
1210  {434.00, 1.71971},
1211  {433.00, 1.59093},
1212  {432.00, 1.73931},
1213  {431.00, 1.18114},
1214  {430.00, 1.43179},
1215  {429.00, 1.61524},
1216  {428.00, 1.55855},
1217  {427.00, 1.68954},
1218  {426.00, 1.67122},
1219  {425.00, 1.83233},
1220  {424.00, 1.66385},
1221  {423.00, 1.62314},
1222  {422.00, 1.93380},
1223  {421.00, 1.73978},
1224  {420.00, 1.73008},
1225  {419.00, 1.58521},
1226  {418.00, 1.60288},
1227  {417.00, 1.95848},
1228  {416.00, 1.69074},
1229  {415.00, 1.75825},
1230  {414.00, 1.72855},
1231  {413.00, 1.78972},
1232  {412.00, 1.84721},
1233  {411.00, 1.60548},
1234  {410.00, 1.68896},
1235  {409.00, 1.70336},
1236  {408.00, 1.64855},
1237  {407.00, 1.60358},
1238  {406.00, 1.66262},
1239  {405.00, 1.61197},
1240  {404.00, 1.66177},
1241  {403.00, 1.69945},
1242  {402.00, 1.85464},
1243  {401.00, 1.74765},
1244  {400.00, 1.65557},
1245  {399.00, 1.55885},
1246  {398.00, .98892},
1247  {397.00, .73157},
1248  {396.00, 1.36058},
1249  {395.00, 1.16506},
1250  {394.00, .51918},
1251  {393.00, .96770},
1252  {392.00, 1.35593},
1253  {391.00, 1.20391},
1254  {390.00, 1.27662},
1255  {389.00, .95946},
1256  {388.00, 1.03225},
1257  {387.00, .89680},
1258  {386.00, 1.00866},
1259  {385.00, 1.03205},
1260  {384.00, .71553},
1261  {383.00, .72384},
1262  {382.00, 1.06938},
1263  {381.00, 1.26323},
1264  {380.00, 1.09391},
1265  {379.00, 1.42018},
1266  {378.00, 1.37788},
1267  {377.00, 1.24686},
1268  {376.00, 1.14902},
1269  {375.00, .91977},
1270  {374.00, .85347},
1271  {373.00, 1.04017},
1272  {372.00, 1.19835},
1273  {371.00, 1.10971},
1274  {370.00, 1.23693},
1275  {369.00, 1.11109},
1276  {368.00, 1.16056},
1277  {367.00, 1.29568},
1278  {366.00, 1.24442},
1279  {365.00, .94159},
1280  {364.00, 1.03171},
1281  {363.00, 1.13020},
1282  {362.00, .96457},
1283  {361.00, 1.07451},
1284  {360.00, 1.07420},
1285  {359.00, .64928},
1286  {358.00, .85466},
1287  {357.00, .92873},
1288  {356.00, 1.07914},
1289  {355.00, 1.19326},
1290  {354.00, 1.10298},
1291  {353.00, .93729},
1292  {352.00, .94835},
1293  {351.00, 1.06738},
1294  {350.00, .90599},
1295  {349.00, .89630},
1296  {348.00, .93721},
1297  {347.00, .87770},
1298  {346.00, .96477},
1299  {345.00, .69647},
1300  {344.00, .93273},
1301  {343.00, .95317},
1302  {342.00, .92445},
1303  {341.00, 1.01743},
1304  {340.00, .96269},
1305  {339.00, .93752},
1306  {338.00, .83161},
1307  {337.00, .77820},
1308  {336.00, .94669},
1309  {335.00, .92177},
1310  {334.00, .93237},
1311  {333.00, .96663},
1312  {332.00, .94620},
1313  {331.00, 1.05837},
1314  {330.00, 1.06780},
1315  {329.00, .92378},
1316  {328.00, 1.03023},
1317  {327.00, 1.08882},
1318  {326.00, .74511},
1319  {325.00, .64021},
1320  {324.00, .61387},
1321  {323.00, .74378},
1322  {322.00, .74378},
1323  {321.00, .82054},
1324  {320.00, .74435},
1325  {319.00, .68167},
1326  {318.00, .80912},
1327  {317.00, .62832},
1328  {316.00, .71710},
1329  {315.00, .69875},
1330  {314.00, .69629},
1331  {313.00, .66662},
1332  {312.00, .72524},
1333  {311.00, .58104},
1334  {310.00, .50548},
1335  {309.00, .59188},
1336  {308.00, .67086},
1337  {307.00, .54720},
1338  {306.00, .56630},
1339  {305.00, .51899},
1340  {304.00, .56413},
1341  {303.00, .50060},
1342  {302.00, .61720},
1343  {301.00, .50544},
1344  {300.00, .49927},
1345  {299.00, .49424},
1346  {298.00, .54290},
1347  {297.00, .52618},
1348  {296.00, .59232},
1349  {295.00, .54323},
1350  {294.00, .56829},
1351  {293.00, .55761},
1352  {292.00, .60710},
1353  {291.00, .63478},
1354  {290.00, .52521},
1355  {289.00, .37398},
1356  {288.00, .36223},
1357  {287.00, .36138},
1358  {286.00, .20862},
1359  {285.00, .24310},
1360  {284.00, .34419},
1361  {283.00, .32759},
1362  {282.00, .24273},
1363  {281.00, .13202},
1364  {280.00, .10385},
1365  {279.00, .17168},
1366  {278.00, .24958},
1367  {277.00, .27124},
1368  {276.00, .21274},
1369  {275.00, .15652},
1370  {274.00, .21112},
1371  {273.00, .23353},
1372  {272.00, .24674},
1373  {271.00, .30166},
1374  {270.00, .27652},
1375  {269.00, .27532},
1376  {268.00, .28459},
1377  {267.00, .28227},
1378  {266.00, .29209},
1379  {265.00, .28081},
1380  {264.00, .19431},
1381  {263.00, .12632},
1382  {262.00, .11230},
1383  {261.00, .10629},
1384  {260.00, .12267},
1385  {259.00, .14837},
1386  {258.00, .14702},
1387  {257.00, .12463},
1388  {256.00, .09759},
1389  {255.00, .07485},
1390  {254.00, .06496},
1391  {253.00, .05415},
1392  {252.00, .05655},
1393  {251.00, .06992},
1394  {250.00, 2.51369}
1395  };
1396 
1397  if (lambda < 250. || lambda > 25000.0)
1398  bu_bomb("atmos_irradiance: bad wavelength.");
1399 
1400 
1401  /* Find index of lower lambda in table. */
1402  lo = 0;
1403  hi = NSIRRAD - 1;
1404  j = (NSIRRAD - 1) >> 1;
1405  while (hi - lo > 1) {
1406  if (table[j][0] > lambda)
1407  lo = j;
1408  else if (table[j][0] <= lambda)
1409  hi = j;
1410  j = lo + ((hi - lo) >> 1);
1411  }
1412  /* Do linear interpolation to find approximate values. */
1413  ratio = (lambda - table[j][0]) / (table[j+1][0] - table[j][0]);
1414  irrad = ratio*(table[j+1][1] - table[j][1]) + table[j][1];
1415 
1416  return irrad;
1417 }
1418 
1419 
1420 /*
1421  * Return absorption coefficient due to ozone for a given wavelength
1422  * of light.
1423  * Units: m ^ -1 (inverse m)
1424  *
1425  * Data from Inn, Edward; Tanaka, Yoshio; Journal of the Optical
1426  * Society of America, Volume 43, Number 10, "Absorption Coefficient of
1427  * Ozone in the Ultraviolet and Visible Regions, " October 1953,
1428  * pp. 870-3.
1429  */
1430 fastf_t
1432 /* Wavelength of light. Units: nm. */
1433 {
1434 #define NABSORP 38 /* Number of entries in absorption coefficient table. */
1435 
1436  fastf_t coeff;
1437  fastf_t ratio;
1438  int hi, j, lo;
1439  /* Data in report presented graphically only - I read a hopefully */
1440  /* representative number of samples off the graph as best I could. */
1441  /* Table row: wavelength (nm), absorption coefficient (1/cm). */
1442  static fastf_t table[NABSORP][2] = {
1443  {200., 5.},
1444  {205., 6.},
1445  {210., 7.},
1446  {215., 12.},
1447  {220., 20.},
1448  {225., 35.},
1449  {230., 50.},
1450  {235., 75.},
1451  {240., 93.},
1452  {245., 113.},
1453  {250., 127.},
1454  {255., 135.},
1455  {260., 127.},
1456  {265., 112.},
1457  {270., 88.},
1458  {275., 65.},
1459  {280., 45.},
1460  {285., 28.},
1461  {290., 18.},
1462  {300., 7.},
1463  {325., 1.},
1464  {350., 0.1},
1465  {375., 0.0},
1466  {400., 0.0},
1467  {425., 0.0},
1468  {450., 0.002},
1469  {475., 0.005},
1470  {500., 0.013},
1471  {525., 0.024},
1472  {550., 0.037},
1473  {575., 0.05},
1474  {600., 0.055},
1475  {625., 0.041},
1476  {650., 0.028},
1477  {675., 0.016},
1478  {700., 0.010},
1479  {725., 0.006},
1480  {750., 0.004}
1481  };
1482 
1483  if (lambda < 200. || lambda > 750.0) {
1484  bu_bomb("ozone absorption: bad wavelength.");
1485  }
1486  /* Find index of lower lambda in table. */
1487  lo = 0;
1488  hi = NABSORP - 1;
1489  j = (NABSORP - 1) >> 1;
1490  while (hi - lo > 1) {
1491  if (table[j][0] <= lambda)
1492  lo = j;
1493  else if (table[j][0] > lambda)
1494  hi = j;
1495  j = lo + ((hi - lo) >> 1);
1496  }
1497  /* Do linear interpolation to find approximate values. */
1498  ratio = (lambda - table[j][0]) / (table[j+1][0] - table[j][0]);
1499  coeff = ratio*(table[j+1][1] - table[j][1]) + table[j][1];
1500 
1501  /* Convert units from 1/cm to 1/m */
1502  return /* 100. * */ coeff;
1503 }
1504 
1505 
1506 /**
1507  * Do a table lookup to get data on spectral irradiance of daylight.
1508  * Table taken from Judd, D B; MacAdam, D L; Wyszecki, G J; Journal
1509  * for Optical Science of America, Vol. 54, 1964, "Spectral
1510  * Distribution of Typical Daylight as a Function of Correlated Color
1511  * Temperature, " pp. 1031-40.
1512  */
1513 void
1515 {
1516  fastf_t ratio;
1517  int j;
1518  /* Mean and 1st two characteristic vectors of the composite data */
1519  /* of the spectral absorptance of the earth's atmosphere due to */
1520  /* ozone and water vapor. */
1521  /* table row: wavelength (nm), e_mean, v1, v2 */
1522  /* THESE ARE DIVIDED BY 10 IN "COLOR SCIENCE..." BY WYSZECKI??? */
1523  static fastf_t table[][4] = {
1524  {300., 0.4, 0.2, 0.0},
1525  {310., 60., 45., 20.},
1526  {320., 296., 224., 40.},
1527  {330., 553., 420., 85.},
1528  {340., 573., 406., 78.},
1529  {350., 618., 416., 67.},
1530  {360., 615., 380., 53.},
1531  {370., 688., 424., 61.},
1532  {380., 634., 385., 30.},
1533  {390., 658., 350., 12.},
1534  {400., 949., 434., -11.},
1535  {410., 1048., 463., -5.},
1536  {420., 1059., 439., -7.},
1537  {430., 968., 371., -12.},
1538  {440., 1139., 367., -26.},
1539  {450., 1256., 359., -29.},
1540  {460., 1255., 326., -28.},
1541  {470., 1213., 279., -26.},
1542  {480., 1213., 243., -26.},
1543  {490., 1135., 201., -18.},
1544  {500., 1131., 162., -15.},
1545  {510., 1108., 132., -13.},
1546  {520., 1065., 86., -12.},
1547  {530., 1088., 61., -10.},
1548  {540., 1053., 42., -5.},
1549  {550., 1044., 19., -3.},
1550  {560., 1000., 0.0, 0.0},
1551  {570., 960., -16., 2.},
1552  {580., 951., -35., 5.},
1553  {590., 891., -35., 21.},
1554  {600., 905., -58., 32.},
1555  {610., 903., -72., 41.},
1556  {620., 884., -86., 47.},
1557  {630., 840., -95., 51.},
1558  {640., 851., -109., 67.},
1559  {650., 819., -107., 73.},
1560  {660., 826., -120., 86.},
1561  {670., 849., -140., 98.},
1562  {680., 813., -136., 102.},
1563  {690., 719., -120., 83.},
1564  {700., 743., -133., 96.},
1565  {710., 764., -129., 85.},
1566  {720., 633., -106., 70.},
1567  {730., 717., -116., 76.},
1568  {740., 770., -122., 80.},
1569  {750., 652., -102., 67.},
1570  {760., 477., -78., 52.},
1571  {770., 686., -112., 74.},
1572  {780., 650., -104., 68.},
1573  {790., 660., -106., 70.},
1574  {800., 610., -97., 64.},
1575  {810., 533., -83., 55.},
1576  {820., 589., -93., 61.},
1577  {830., 619., -98., 65.}
1578  };
1579 
1580  if (lambda < 300. || lambda > 830.0) {
1581  bu_bomb("spectral_dist_table: bad wavelength.");
1582  } else {
1583  /* Do linear interpolation to find approximate values. */
1584  j = ((int)lambda - 300)/10;
1585  ratio = (lambda - table[j][0]) / (table[j+1][0] - table[j][0]);
1586  *e_mean = ratio*(table[j+1][1] - table[j][1]) + table[j][1];
1587  *v1 = ratio*(table[j+1][2] - table[j][2]) + table[j][2];
1588  *v2 = ratio*(table[j+1][3] - table[j][3]) + table[j][3];
1589  }
1590 }
1591 
1592 
1593 /**
1594  * Return sky light spectral distribution for a sky element. Because
1595  * to date there is no decisive research on the spectral distribution
1596  * of sky light, the CIE synthesized daylight expression is used. See
1597  * Judd, D B; MacAdam, D L; Wyszecki, G J; Journal for Optical Science
1598  * of America, Vol. 54, 1964, p. 1031.
1599  *
1600  * Units: W/m^2/nm/sr
1601  */
1602 fastf_t
1603 skylight_spectral_dist(fastf_t lambda, fastf_t *Zenith, fastf_t *Sky_elmt, fastf_t *Sun, int weather, fastf_t t_vl)
1604 /* Wavelength of light (nm). */
1605 /* Vector to sky zenith. */
1606 /* Vector to sky element of interest. */
1607 /* Vector to sun. */
1608 /* Weather condition. */
1609 /* Turbidity factor. */
1610 {
1611  fastf_t e_mean = 0.0, v1 = 0.0, v2 = 0.0,
1612  lum, /* Luminance at a given point in the sky (cd/m^2). */
1613  lz, /* Luminance at the zenith. Units: cd/m^2 */
1614  m1, m2,
1615  sd, /* Spectral distribution at a given point in the */
1616  /* sky. Units: W/m^2/nm/sr */
1617  sun_alt, /* Altitude of sun. */
1618  t_cp, /* Correlated color temperature corresponding */
1619  /* to a given luminance. Units: K */
1620  x, y; /* 1931 CIE chromaticity coordinates. */
1621 
1622  sun_alt = 90 - acos(VDOT(Sun, Zenith))*RAD2DEG;
1623  lz = zenith_luminance(sun_alt, t_vl);
1624  /* Get luminance distribution */
1625  switch (weather) {
1626  case CLEAR_SKY:
1627  lum = clear_sky_lum(lz, Sky_elmt, Sun, Zenith);
1628  break;
1629  case MEDIUM_SKY:
1630  lum = homogenous_sky_lum(Sky_elmt, Sun, t_vl);
1631  break;
1632  case OVERCAST_SKY: /* fallthrough */
1633  default:
1634  lum = overcast_sky_lum(lz, Zenith, Sky_elmt);
1635  break;
1636  }
1637 /* XXX hack */
1638  if (lum <= 0.0) {/*bu_log("lum = %g\n", lum);*/ return 0.0;}
1639 
1640  /* Convert to color temperature. Expression based on careful */
1641  /* measurements by Toyota. */
1642  t_cp = 1.1985e8/pow(lum, 1.2) + 6500.0; /* Kelvin */
1643 
1644  /* Convert color temperature into spectral distribution */
1645  /* using CIE synthesized daylight expression. */
1646 
1647  /* Chromaticity coordinates, taken from Wyszecki, Guenter; Stiles, */
1648  /* WS; "Color Science: Concepts and Methods, Quantitative Data and */
1649  /* Formulae, " John Wiley and Sons, 1982, pp. 145-6. */
1650  if (t_cp >= 4000. && t_cp < 7000.0) {
1651  x =
1652  -4.6070e9/(t_cp*t_cp*t_cp)
1653  + 2.9678e6/(t_cp*t_cp)
1654  + 0.09911e3/t_cp
1655  + 0.244063;
1656  } else if (t_cp >= 7000. && t_cp <= 25000.0) {
1657  x =
1658  -2.0064e9/(t_cp*t_cp*t_cp)
1659  + 1.9018e6/(t_cp*t_cp)
1660  + 0.24748e3/t_cp
1661  + 0.237040;
1662  } else {
1663  bu_log("skylight_spectral_dist: color temperature %lf out of range, lum=%lf.\n", t_cp, lum);
1664  t_cp = 25000;
1665  x =
1666  -2.0064e9/(t_cp*t_cp*t_cp)
1667  + 1.9018e6/(t_cp*t_cp)
1668  + 0.24748e3/t_cp
1669  + 0.237040;
1670  }
1671  y = 2.870*x - 3.000*x*x - 0.275;
1672 
1673  /* Scalar multiples of 1st two characteristic vectors needed to */
1674  /* reconstitute spectral distribution curves of typical daylight. */
1675  m1 = -1.3515 - 1.7703*x + 5.9114*y;
1676  m2 = 1./(0.0241 + 0.2562*x - 0.7341*y);
1677  m1 *= m2;
1678  m2 *= 0.0300 - 31.4424*x + 30.0717*y;
1679 
1680  /* Do table lookup for spectral distribution data. */
1681  spectral_dist_table(lambda, &e_mean, &v1, &v2);
1682 
1683  /* Get spectral distribution for sky element of interest. */
1684  sd = e_mean + m1*v1 + m2*v2;
1685 
1686  return sd;
1687 }
1688 
1689 
1690 /**
1691  * Calculate spectral radiance of sun on ground. Units: W/m^2/nm/sr.
1692  */
1693 fastf_t
1694 sun_radiance(fastf_t lambda, fastf_t alpha, fastf_t beta, fastf_t sun_alt, fastf_t sun_sang)
1695 /* Wavelength of light (nm). */
1696 /* Coefficients of turbidity. */
1697 /* Altitude of sun above horizon. */
1698 /* Solid angle of sun as seen from ground. */
1699 {
1700  fastf_t cm, /* Attenuation factor according to diffusion of */
1701  /* aerosol (unitless?). */
1702  coz, /* Absorption coefficient due the absorption of */
1703  /* ozone (1/m). */
1704  cr, /* Attenuation factor according to Rayleigh */
1705  /* diffusion of air molecules (unitless?). */
1706  e0, /* Spectral irradiance out of atmosphere (W/m^2). */
1707  em, /* Spectral irradiance on the ground surface */
1708  /* (W/m^2/nm). */
1709  lmicro, /* lambda in um, (10^-6 m). */
1710  ls; /* Spectral radiance of sun on ground (W/m^2/nm/sr). */
1711 
1712  lmicro = lambda/1000;
1713  e0 = atmos_irradiance(lambda);
1714  cr = 0.00864
1715  * pow(lmicro,
1716  -(3.916 + 0.074*lmicro + 0.050/lmicro));
1717  cm = beta * pow(lmicro, -alpha*lmicro);
1718  coz = ozone_absorption(lambda);
1719  em = e0 * exp(-(cr + cm + coz)*air_mass(sun_alt));
1720  ls = em/sun_sang;
1721  return ls;
1722 }
1723 
1724 
1725 /**
1726  * Return reflectance of a material with only regular (specular)
1727  * reflectance using Fresnel's equations. For materials other than
1728  * glass, it is better to measure the specular reflectance since
1729  * usually it will not follow Fresnel's formula.
1730  *
1731  * Note: This works only for unpolarized light. For polarized
1732  * skylight, the formula must be extended.
1733  *
1734  * SHOULD CONTACT TOYOTA TO UNDERSTAND WHAT THEY DID.
1735  */
1736 fastf_t
1738 /* Cosine of angle of incidence on the medium. */
1739 /* Index of refraction of material (usually air)
1740  * in contact with the medium under test. */
1741 /* Index of refraction of the medium. */
1742 {
1743  fastf_t refl; /* Returned reflectance. */
1744  fastf_t p_parallel; /* Reflectance for a plane-polarized beam
1745  * of radiant energy so oriented that the
1746  * plane of vibration of the electric vector
1747  * is parallel to the plane of incidence
1748  * defined by the central ray of the medium.
1749  */
1750  fastf_t p_perpendicular;/* Reflectance for a plane-polarized beam
1751  * whose radiant energy plane of vibration
1752  * is perpendicular to the plane of incidence.
1753  */
1754  fastf_t work, work2; /* Intermediate results. */
1755 
1756  work2 = (n2/n1)*(n2/n1);
1757  work = sqrt(work2 - (1.0 - cos_eps*cos_eps));
1758 
1759  p_parallel = (cos_eps - work)/(cos_eps + work);
1760  p_parallel *= p_parallel;
1761 
1762  p_perpendicular = (work2*cos_eps - work)/(work2*cos_eps + work);
1763  p_perpendicular *= p_perpendicular;
1764 
1765  /* Only accurate for unpolarized radiant energy. */
1766  refl = 0.5 * (p_parallel + p_perpendicular);
1767 
1768  return refl;
1769 }
1770 
1771 
1772 /**
1773  * For each type of material which has had its absorption coefficient
1774  * measured, linear interpolation between data points is used to
1775  * return the absorption coefficient for a given wavelength.
1776  *
1777  * Data files are 2 column ascii: wavelength (nm), absorption
1778  * coefficient (1/m).
1779  */
1780 fastf_t
1781 absorp_coeff(fastf_t lambda, char *material)
1782 /* wavelength (nm) */
1783 
1784 {
1785  char mfile[80];
1786  double a, l;
1787  fastf_t absorp, absorp_h, absorp_l, lambda_h, lambda_l;
1788  fastf_t abso1, lamb1, lamb2, lambrat;
1789  FILE *fp;
1790  int n;
1791 
1792  /* Do nothing, user has his own absorption data. */
1793  bu_strlcpy(mfile, material, sizeof(mfile));
1794  if ((fp = fopen(mfile, "rb")) == NULL) {
1795  fprintf(stderr,
1796  "absorp_coeff: cannot open %s for reading.", mfile);
1797  bu_bomb("");
1798  }
1799 
1800  /* Find "nearby" values of lambda, absorption for interpolation. */
1801  if ((n = fscanf(fp, "%lf %lf", &l, &a)) != 2 || lambda + MIKE_TOL < l) {
1802  fclose(fp);
1803  return -1.0;
1804  }
1805  lambda_l = l;
1806  absorp_l = a;
1807 
1808  /* Find low lambda. */
1809  while ((n = fscanf(fp, "%lf %lf", &l, &a)) == 2 && l < lambda) {
1810  lambda_l = l;
1811  absorp_l = a;
1812  }
1813  if (n != 2) {
1814  fclose(fp);
1815  return -1.0;
1816  } else {
1817  lambda_h = l;
1818  absorp_h = a;
1819  }
1820 
1821  fclose(fp);
1822 
1823  /* double casts to avoid coverity overflow warning */
1824  abso1 = (double)absorp_h - (double)absorp_l;
1825  lamb1 = (double)lambda - (double)lambda_l;
1826  lamb2 = (double)lambda_h - (double)lambda_l;
1827  lambrat = (double)lamb1 / (double)lamb2;
1828  absorp = (double)abso1 * (double)lambrat;
1829  absorp += (double)absorp_l;
1830  return absorp;
1831 }
1832 
1833 
1834 /**
1835  * For each type of material which has had its spectral reflectance
1836  * measured, linear interpolation between data points is used to
1837  * return the reflectance factor for a given wavelength and a given
1838  * angle of light incidence.
1839  *
1840  * Data files are 3 column ascii: wavelength, angle, reflectance.
1841  */
1842 fastf_t
1843 reflectance(fastf_t lambda, fastf_t alpha, fastf_t *refl, int lines)
1844 /* Wavelength (nm). */
1845 /* Angle of incident light, in degrees. */
1846 /* Reflectance data. */
1847 /* How many lines of data in refl[]. */
1848 {
1849  fastf_t alpha_hh, alpha_hl, alpha_lh, alpha_ll,
1850  beta_hh, beta_hl, beta_lh, beta_ll,
1851  beta_l, beta_h,
1852  beta,
1853  lambda_h, lambda_l,
1854  l;
1855  int i, j;
1856 
1857  /* Find low lambda. */
1858  for (l = 0, i = 0; l < lambda && i < lines; i++) {
1859  l = refl[i*3];
1860  }
1861 
1862  if (i == 0 || i >= lines) {
1863  beta = -1;
1864  goto out;
1865  }
1866 
1867  j = --i;
1868  i--;
1869  lambda_l = refl[i*3];
1870  while (i >= 0 && EQUAL(refl[i*3], lambda_l) && refl[i*3+1] > alpha)
1871  i--;
1872 
1873  if (i < 0) {
1874  beta = -1;
1875  goto out;
1876  }
1877 
1878  if (EQUAL(refl[(i+1)*3], lambda_l)) {
1879  alpha_ll = refl[i*3+1];
1880  beta_ll = refl[i*3+2];
1881  alpha_lh = refl[(i+1)*3+1];
1882  beta_lh = refl[(i+1)*3+2];
1883  } else {
1884  alpha_ll = refl[(i-1)*3+1];
1885  beta_ll = refl[(i-1)*3+2];
1886  alpha_lh = refl[i*3+1];
1887  beta_lh = refl[i*3+2];
1888  }
1889 
1890  lambda_h = refl[j*3]; /* High lambda. */
1891  while (j < lines && EQUAL(refl[j*3], lambda_h) && refl[j*3+1] < alpha) {
1892  j++;
1893  }
1894 
1895  if (j >= lines) {
1896  beta = -1;
1897  goto out;
1898  }
1899 
1900  if (EQUAL(refl[(j-1)*3], lambda_h)) {
1901  alpha_hl = refl[(j-1)*3+1];
1902  beta_hl = refl[(j-1)*3+2];
1903  alpha_hh = refl[j*3+1];
1904  beta_hh = refl[j*3+2];
1905  } else {
1906  alpha_hl = refl[j*3+1];
1907  beta_hl = refl[j*3+2];
1908  alpha_hh = refl[(j+1)*3+1];
1909  beta_hh = refl[(j+1)*3+2];
1910  }
1911 
1912  /* Interpolate beta between alphas of lower lambda. */
1913  beta_l = (beta_lh - beta_ll)/(alpha_lh - alpha_ll)*(alpha - alpha_ll)
1914  + beta_ll;
1915  /* Interpolate beta between alphas of higher lambda. */
1916  beta_h = (beta_hh - beta_hl)/(alpha_hh - alpha_hl)*(alpha - alpha_hl)
1917  + beta_hl;
1918  /* Interpolate beta between low and high lambdas. */
1919  beta = (beta_h - beta_l)/(lambda_h - lambda_l)*(lambda - lambda_l)
1920  + beta_l;
1921 
1922 out:
1923  return beta;
1924 }
1925 
1926 
1927 /**
1928  * Given a wavelength in nm of light, return its rgb approximation.
1929  *
1930  * Taken from Wyszecki, Guenter; Stiles, WS; "Color Science: Concepts
1931  * and Methods, Quantitative Data and Formulae, " John Wiley and Sons,
1932  * 1982, pp. 615, table taken from pp. 806-7.
1933  *
1934  * They, in turn, took the data from Vos, J J, Colorimetric and
1935  * photometric properties of a 2 degree fundamental observer, "Color
1936  * Res. & Appl. 3", 125 (1978).
1937  *
1938  * Table row: wavelength, x_bar(lambda), y_bar(lambda), z_bar(lambda).
1939  */
1940 void
1941 lambda_to_rgb(fastf_t lambda, fastf_t irrad, fastf_t *rgb)
1942 /* Input, wavelength of light. */
1943 /* Input, irradiance of light. */
1944 /* Output, RGB approximation of input. */
1945 {
1946 
1947 /* Number of entries in color matching table. */
1948 #define NCOLOR 90
1949 
1950  fastf_t krx, kry, krz, kgx, kgy, kgz, kbz;
1951  fastf_t ratio, r, g, b, x, y, z;
1952  static const fastf_t table[NCOLOR][4] = {
1953  {380, 0.26899e-2, 0.20000e-3, 0.12260e-1},
1954  {385, 0.53105e-2, 0.39556e-3, 0.24222e-1},
1955  {390, 0.10781e-1, 0.80000e-3, 0.49250e-1},
1956  {395, 0.20792e-1, 0.15457e-2, 0.95135e-1},
1957  {400, 0.37981e-1, 0.28000e-2, 0.17409},
1958  {405, 0.63157e-1, 0.46562e-2, 0.29013},
1959  {410, 0.99941e-1, 0.74000e-2, 0.46053},
1960  {415, 0.15824, 0.11779e-1, 0.73166},
1961  {420, 0.22948, 0.17500e-1, 0.10658e1},
1962  {425, 0.28108, 0.22678e-1, 0.13146e1},
1963  {430, 0.31095, 0.27300e-1, 0.14672e1},
1964  {435, 0.33072, 0.32584e-1, 0.15796e1},
1965  {440, 0.33336, 0.37900e-1, 0.16166e1},
1966  {445, 0.31672, 0.42391e-1, 0.15682e1},
1967  {450, 0.28882, 0.46800e-1, 0.14717e1},
1968  {455, 0.25969, 0.52122e-1, 0.13740e1},
1969  {460, 0.23276, 0.60000e-1, 0.12917e1},
1970  {465, 0.20999, 0.72942e-1, 0.12356e1},
1971  {470, 0.17476, 0.90980e-1, 0.11138e1},
1972  {475, 0.13287, 0.11284, 0.94220},
1973  {480, 0.91944e-1, 0.13902, 0.75596},
1974  {485, 0.56985e-1, 0.16987, 0.58640},
1975  {490, 0.31731e-1, 0.20802, 0.44669},
1976  {495, 0.14613e-1, 0.25808, 0.34116},
1977  {500, 0.48491e-2, 0.32300, 0.26437},
1978  {505, 0.23215e-2, 0.40540, 0.20594},
1979  {510, 0.92899e-2, 0.50300, 0.15445},
1980  {515, 0.29278e-1, 0.60811, 0.10918},
1981  {520, 0.63791e-1, 0.71000, 0.76585e-1},
1982  {525, 0.11081, 0.79510, 0.56227e-1},
1983  {530, 0.16692, 0.86200, 0.41366e-1},
1984  {535, 0.22768, 0.91505, 0.29353e-1},
1985  {540, 0.29269, 0.95400, 0.20042e-1},
1986  {545, 0.36225, 0.98004, 0.13312e-1},
1987  {550, 0.43635, 0.99495, 0.87823e-2},
1988  {555, 0.51513, 0.10001e1, 0.58573e-2},
1989  {560, 0.59748, 0.99500, 0.40493e-2},
1990  {565, 0.68121, 0.97875, 0.29217e-2},
1991  {570, 0.76425, 0.95200, 0.22771e-2},
1992  {575, 0.84394, 0.91558, 0.19706e-2},
1993  {580, 0.91635, 0.87000, 0.18066e-2},
1994  {585, 0.97703, 0.81623, 0.15449e-2},
1995  {590, 0.10230e1, 0.75700, 0.12348e-2},
1996  {595, 0.10513e1, 0.69483, 0.11177e-2},
1997  {600, 0.10550e1, 0.63100, 0.90564e-3},
1998  {605, 0.10362e1, 0.56654, 0.69467e-3},
1999  {610, 0.99239, 0.50300, 0.42885e-3},
2000  {615, 0.92861, 0.44172, 0.31817e-3},
2001  {620, 0.84346, 0.38100, 0.25598e-3},
2002  {625, 0.73983, 0.32052, 0.15679e-3},
2003  {630, 0.63289, 0.26500, 0.97694e-4},
2004  {635, 0.53351, 0.21702, 0.68944e-4},
2005  {640, 0.44062, 0.17500, 0.51165e-4},
2006  {645, 0.35453, 0.13812, 0.36016e-4},
2007  {650, 0.27862, 0.10700, 0.24238e-4},
2008  {655, 0.21485, 0.81652e-1, 0.16915e-4},
2009  {660, 0.16161, 0.61000e-1, 0.11906e-4},
2010  {665, 0.11820, 0.44327e-1, 0.81489e-5},
2011  {670, 0.85753e-1, 0.32000e-1, 0.56006e-5},
2012  {675, 0.63077e-1, 0.23454e-1, 0.39544e-5},
2013  {680, 0.45834e-1, 0.17000e-1, 0.27912e-5},
2014  {685, 0.32057e-1, 0.11872e-1, 0.19176e-5},
2015  {690, 0.22187e-1, 0.82100e-2, 0.13135e-5},
2016  {695, 0.15612e-1, 0.57723e-2, 0.91519e-6},
2017  {700, 0.11098e-1, 0.41020e-2, 0.64767e-6},
2018  {705, 0.79233e-2, 0.29291e-2, 0.46352e-6},
2019  {710, 0.56531e-2, 0.20910e-2, 0.33304e-6},
2020  {715, 0.40039e-2, 0.14822e-2, 0.23823e-6},
2021  {720, 0.28253e-2, 0.10470e-2, 0.17026e-6},
2022  {725, 0.19947e-2, 0.74015e-3, 0.12207e-6},
2023  {730, 0.13994e-2, 0.52000e-3, 0.87107e-7},
2024  {735, 0.96980e-3, 0.36093e-3, 0.61455e-7},
2025  {740, 0.66847e-3, 0.24920e-3, 0.43162e-7},
2026  {745, 0.46141e-3, 0.17231e-3, 0.30379e-7},
2027  {750, 0.32073e-3, 0.12000e-3, 0.21554e-7},
2028  {755, 0.22573e-3, 0.84620e-4, 0.15493e-7},
2029  {760, 0.15973e-3, 0.60000e-4, 0.11204e-7},
2030  {765, 0.11275e-3, 0.42446e-4, 0.80873e-8},
2031  {770, 0.79513e-4, 0.30000e-4, 0.58340e-8},
2032  {775, 0.56087e-4, 0.21210e-4, 0.42110e-8},
2033  {780, 0.39541e-4, 0.14989e-4, 0.30383e-8},
2034  {785, 0.27852e-4, 0.10584e-4, 0.21907e-8},
2035  {790, 0.19597e-4, 0.74656e-5, 0.15778e-8},
2036  {795, 0.13770e-4, 0.52592e-5, 0.11348e-8},
2037  {800, 0.96700e-5, 0.37028e-5, 0.81565e-9},
2038  {805, 0.67918e-5, 0.26076e-5, 0.58626e-9},
2039  {810, 0.47706e-5, 0.18365e-5, 0.42138e-9},
2040  {815, 0.33550e-5, 0.12950e-5, 0.30319e-9},
2041  {820, 0.23534e-5, 0.91092e-6, 0.21753e-9},
2042  {825, 0.16377e-5, 0.63564e-6, 0.15476e-9}
2043  };
2044  int hi, j, lo;
2045 
2046  /* Vos(1978) xyz to rgb conversion matrix values. */
2047  krx = 0.1551646;
2048  kry= 0.5430763;
2049  krz= -0.0370161;
2050 
2051  kgx = -0.1551646;
2052  kgy = 0.4569237;
2053  kgz = 0.0296946;
2054 
2055  kbz = 0.0073215;
2056 
2057  /* Interpolate values of x, y, z. */
2058  if (lambda < 380. || lambda > 825.0) {
2059  bu_log("lambda_to_rgb: bad wavelength, %g nm.", lambda);
2060  bu_bomb("");
2061  }
2062  /* Find index of lower lambda in table. */
2063  lo = 0;
2064  hi = NCOLOR - 1;
2065  j = (NCOLOR - 1) >> 1;
2066  while (hi - lo > 1) {
2067  if (table[j][0] <= lambda)
2068  lo = j;
2069  else if (table[j][0] > lambda)
2070  hi = j;
2071  j = lo + ((hi - lo) >> 1);
2072  }
2073  /* Do linear interpolation to find approximate values. */
2074  ratio = (lambda - table[j][0]) / (table[j+1][0] - table[j][0]);
2075  x = ratio*(table[j+1][1] - table[j][1]) + table[j][1];
2076  y = ratio*(table[j+1][2] - table[j][2]) + table[j][2];
2077  z = ratio*(table[j+1][3] - table[j][3]) + table[j][3];
2078 
2079 
2080  /* Convert xyz to rgb. */
2081  r = krx*x + kry*y + krz*z;
2082  g = kgx*x + kgy*y + kgz*z;
2083  b = kbz*z;
2084 
2085  /* Convert relative rgb into displayable rgb. */
2086 /* SOMEHOW NEED TO USE IRRAD, BUT DON'T KNOW ITS VALUES YET */
2087  rgb[0] += r/(r+g+b) * irrad/1e4;
2088  rgb[1] += g/(r+g+b) * irrad/1e4;
2089  rgb[2] += b/(r+g+b) * irrad/1e4;
2090  bu_log("rgb = (%g %g %g), irrad = %g\n", r, g, b, irrad);
2091 }
2092 
2093 
2094 /**
2095  * Calculate radiance of background light. For a given wavelength,
2096  * non-zero reflectance values for a range of incident light angles
2097  * determine the solid angle of contributing background light.
2098  *
2099  * Units: W/m^2/nm/sr
2100  *
2101  */
2102 fastf_t
2103 background_light(fastf_t lambda, struct toyota_specific *ts, fastf_t *Refl, fastf_t *Sun, fastf_t t_vl, struct shadework *swp)
2104 /* Wavelength of light (nm). */
2105 
2106 /* Regularly reflected ray. */
2107 /* Vector pointing to sun. */
2108 /* Atmospheric turbidity. */
2109 /* Holds surface normal. */
2110 {
2111  fastf_t alpha0, alpha1, alpha_c,
2112  ang,
2113  bg_radiance,
2114  del_omega,
2115  irradiance,
2116  phi,
2117  r,
2118  refl,
2119  x, y;
2120  fastf_t i_dot_n = .9999;
2121  vect_t Ctr,
2122  Horiz,
2123  Sky_elmnt,
2124  Xaxis, Yaxis,
2125  work;
2126 
2127  /* initialize Sky_elmnt for compiler */
2128  VSETALL(Sky_elmnt, 0.0);
2129 
2130 /* Angular spread between vectors used in solid angle integration. */
2131 #define SPREAD (10*DEG2RAD)
2132 
2133  /* Differential solid angle. */
2134  del_omega = M_PI*sin(SPREAD/2)*sin(SPREAD/2);
2135 
2136  /* Find limits of solid angle. */
2137  alpha0 = 0.0; /* degrees. */
2138  refl = reflectance(lambda, alpha0, ts->refl, ts->refl_lines);
2139  while (refl < MIKE_TOL) {
2140  if (EQUAL(refl, -1.0))
2141  bu_bomb("toyota render: no reflectance data.");
2142  alpha0++;
2143  refl = reflectance(lambda, alpha0, ts->refl, ts->refl_lines);
2144  }
2145  alpha1 = alpha0; /* degrees. */
2146  while (refl > MIKE_TOL && alpha1 < 90.0) {
2147  alpha1++;
2148  refl = reflectance(lambda, alpha1, ts->refl, ts->refl_lines);
2149  }
2150  if (EQUAL(refl, -1.0))
2151  alpha1--;
2152  alpha_c = (alpha0 + alpha1)/2; /* degrees. */
2153  alpha_c *= DEG2RAD; /* radians. */
2154 
2155  /* Find horizontal component of reflected light. */
2156  if (!NEAR_EQUAL(VDOT(swp->sw_hit.hit_normal, Refl), 1.0, MIKE_TOL)) {
2157  VCROSS(Yaxis, swp->sw_hit.hit_normal, Refl);
2158  } else {
2159  /* R and N are the same vector. */
2160  bn_vec_ortho(Yaxis, swp->sw_hit.hit_normal);
2161  }
2162  VCROSS(Horiz, Yaxis, swp->sw_hit.hit_normal);
2163 
2164  /* Get vector which cuts through center of solid angle. */
2165  VBLEND2(Ctr, cos(alpha_c), swp->sw_hit.hit_normal,
2166  sin(alpha_c), Horiz);
2167  VUNITIZE(Yaxis);
2168  VUNITIZE(Ctr);
2169 
2170  /* Angle between Ctr and edge of solid angle. */
2171  alpha_c = (alpha1 - alpha0)/2; /* degrees. */
2172  alpha_c *= DEG2RAD; /* radians. */
2173 
2174  /* Set up coord axes with Ctr as Z axis. */
2175  VCROSS(Xaxis, Yaxis, Ctr);
2176 
2177  irradiance = 0.0;
2178  /* Integrate over solid angle. */
2179 /* JUST INTEGRATE OVER HEMISPHERE - THIS IS CURRENTLY WRONG */
2180  for (ang = SPREAD; ang < alpha_c; ang += SPREAD) {
2181  r = sin(ang);
2182  for (phi = 0.0; phi < M_2PI; phi += SPREAD) {
2183  x = r*cos(phi);
2184  y = r*sin(phi);
2185  VJOIN2(Sky_elmnt, Ctr, x, Xaxis, y, Yaxis);
2186  VUNITIZE(Sky_elmnt);
2187  i_dot_n = VDOT(swp->sw_hit.hit_normal, Sky_elmnt);
2188  if (i_dot_n >= 1.0) i_dot_n = .9999;
2189  if (rdebug&RDEBUG_RAYPLOT) {
2190  VSCALE(work, Sky_elmnt, 200.0);
2191  VADD2(work, swp->sw_hit.hit_point, work);
2192  pl_color(stdout, 0, 255, 0);
2193  pdv_3line(stdout, swp->sw_hit.hit_point, work);
2194  }
2195  /* XXX hack: just assume skylight */
2196  bg_radiance = skylight_spectral_dist(
2197  lambda, ts->Zenith, Sky_elmnt,
2198  Sun, ts->weather, t_vl);
2199  /* XXX hack */ if (i_dot_n > 0.0) {
2200  irradiance +=
2201  reflectance(lambda, acos(i_dot_n)*RAD2DEG,
2202  ts->refl, ts->refl_lines)
2203  * bg_radiance
2204  * i_dot_n
2205  * del_omega;
2206  }
2207  }
2208  }
2209  /* Don't forget contribution from luminance at Ctr. */
2210  bg_radiance = skylight_spectral_dist(lambda, ts->Zenith, Ctr,
2211  Sun, ts->weather, t_vl);
2212  if (rdebug&RDEBUG_RAYPLOT) {
2213  VSCALE(work, Ctr, 200.0);
2214  VADD2(work, swp->sw_hit.hit_point, work);
2215  pl_color(stdout, 255, 50, 0);
2216  pdv_3line(stdout, swp->sw_hit.hit_point, work);
2217  }
2218  irradiance +=
2219  reflectance(lambda, acos(i_dot_n)*RAD2DEG, ts->refl, ts->refl_lines)
2220  * bg_radiance
2221  * VDOT(Sky_elmnt, swp->sw_hit.hit_normal)
2222  * del_omega;
2223  irradiance *= M_1_PI;
2224 
2225  return irradiance;
2226 }
2227 
2228 
2229 /**
2230  * Lighting model developed by Toyota. "Technique makes it possible
2231  * to:
2232  *
2233  * (1) Generate an image as if it is an actual object.
2234  * (2) Render any material and color.
2235  * (3) Render the appearance at any place and time under
2236  * any weather conditions."
2237  */
2238 HIDDEN int
2239 toyota_render(register struct application *ap, const struct partition *UNUSED(pp), struct shadework *swp, void *dp)
2240 {
2241  fastf_t direct_sunlight,
2242  dist, /* Distance light travels (m). */
2243  f, /* Fresnel factor. */
2244  i_dot_n, /* Incident light DOT Normal. */
2245  i_refl, /* Radiance of reflected light. */
2246  refl_radiance, /* Radiance of reflected ray. */
2247  rx, ry,
2248  specular_light,
2249  sun_alt, /* Altitude of sun over horizon. */
2250  sun_dot_n, /* Sun, Normal dot product. */
2251  t_vl, /* Atmospheric turbidity. */
2252  theta,
2253  transmitted_light,
2254  trans_radiance; /* Radiance of transmitted ray. */
2255  int i;
2256  register struct light_specific *lp;
2257  struct toyota_specific *ts =
2258  (struct toyota_specific *)dp;
2259  vect_t Horiz,
2260  Reflected,
2261  Sun, /* Vector to sun. */
2262  Transmitted,
2263  work;
2264 
2265  swp->sw_color[0] = swp->sw_color[1] = swp->sw_color[2] = 0;
2266 
2267  ts->wavelength = 450; /* XXX nm */
2268 
2269  i_refl = 0.0;
2270  /* Consider effects of light source (>1 doesn't make sense really). */
2271  for (i=ap->a_rt_i->rti_nlights-1; i >= 0; i--) {
2272 
2273 /* WHY DOES THIS CAUSE THE BLACK CRESCENT ON THE SPHERE? */
2274  if ((lp = (struct light_specific *)swp->sw_visible[i])
2275  == LIGHT_NULL)
2276  continue; /* shadowed */
2277 
2278  /* Light is not shadowed -- add this contribution */
2279 /* UNNECESSARY intensity = swp->sw_intensity+3*i; */
2280 /* UNNECESSARY VMOVE(Sun, swp->sw_tolight+3*i); */
2281  VMOVE(Sun, lp->lt_pos);
2282  VUNITIZE(Sun);
2283 /* VPRINT("Sun", Sun); */
2284  /* Altitude of sun above horizon (degrees). */
2285  sun_alt = 90 - acos(VDOT(Sun, ts->Zenith)) * RAD2DEG;
2286 
2287  /* Create reflected ray. */
2288  i_dot_n = VDOT(swp->sw_hit.hit_normal, ap->a_ray.r_dir);
2289  if (i_dot_n > 1.0) i_dot_n = .9999;
2290  VSCALE(work, swp->sw_hit.hit_normal, 2*i_dot_n);
2291  VSUB2(Reflected, work, ap->a_ray.r_dir);
2292  VUNITIZE(Reflected);
2293  VREVERSE(Reflected, Reflected);
2294 
2295  /* Cosine of angle between sun and surface normal. */
2296  sun_dot_n = VDOT(swp->sw_hit.hit_normal, Sun);
2297 
2298  f = fresnel_refl(i_dot_n, RI_AIR, ts->index_refrac);
2299 
2300  /* Direct sunlight contribution. */
2301  direct_sunlight =
2302  M_1_PI
2303  * reflectance(ts->wavelength, acos(i_dot_n)*RAD2DEG,
2304  ts->refl, ts->refl_lines)
2305  * sun_radiance(ts->wavelength, ts->alpha, ts->beta,
2306  sun_alt, ts->sun_sang)
2307  * sun_dot_n
2308  * ts->sun_sang;
2309 
2310  /* XXX Hack: it always misses */
2311  if (rdebug&RDEBUG_RAYPLOT) {
2312  VSCALE(work, Reflected, 200.0);
2313  VADD2(work, swp->sw_hit.hit_point, work);
2314  pl_color(stdout, 0, 150, 255);
2315  pdv_3line(stdout, swp->sw_hit.hit_point, work);
2316  }
2317  t_vl = 0; /* XXX Was uninitialized variable */
2318  refl_radiance = skylight_spectral_dist(ts->wavelength,
2319  ts->Zenith, Reflected, Sun, ts->weather, t_vl);
2320 
2321  /* Regularly reflected light contribution. */
2322  specular_light = f * refl_radiance;
2323 
2324  i_refl +=
2325  direct_sunlight
2326  + specular_light
2327  + background_light(ts->wavelength, ts, Reflected, Sun,
2328  t_vl, swp);
2329 
2330  /* Regularly transmitted light contribution. */
2331  if (ts->glass) {
2332 
2333  /* Find horizontal component of reflected light. */
2334  ry = VDOT(swp->sw_hit.hit_normal, Reflected);
2335  theta = acos(ry);
2336  rx = sin(theta);
2337  VSCALE(Horiz, swp->sw_hit.hit_normal, ry);
2338  VSUB2(Horiz, Reflected, Horiz);
2339  VSCALE(Horiz, Horiz, 1/rx);
2340  VUNITIZE(Horiz);
2341 
2342  /* Snell's Law of Refraction (with air). */
2343  theta = asin(sin(acos(i_dot_n))/ts->index_refrac);
2344  /* Generate transmitted ray. */
2345  VBLEND2(Transmitted, sin(theta), Horiz,
2346  -cos(theta), swp->sw_hit.hit_normal);
2347  VUNITIZE(Transmitted);
2348  trans_radiance = skylight_spectral_dist(
2349  ts->wavelength, ts->Zenith, Transmitted,
2350  Sun, ts->weather, t_vl);
2351 
2352  dist = 1; /* XXX what distance to use? */
2353  transmitted_light =
2354  (1 - f)
2355  * trans_radiance
2356  * exp(-absorp_coeff(ts->wavelength, ts->material)
2357  /* NEED THIS STILL! */ * dist);
2358  i_refl += transmitted_light;
2359  }
2360 
2361  i_refl *= lp->lt_fraction;
2362 
2363  /* WHERE DOES THIS GO?? NOT HERE. SO WHERE DOES i_refl GO THEN. */
2364  /* Convert wavelength and radiance into RGB triple. */
2365  lambda_to_rgb(ts->wavelength, i_refl, swp->sw_color);
2366  }
2367 
2368  /* Turn off colorview()'s handling of reflect/refract */
2369  swp->sw_reflect = 0;
2370  swp->sw_transmit = 0;
2371  return 1;
2372 }
2373 
2374 
2375 /*
2376  * Local Variables:
2377  * mode: C
2378  * tab-width: 8
2379  * indent-tabs-mode: t
2380  * c-file-style: "stroustrup"
2381  * End:
2382  * ex: shiftwidth=4 tabstop=8
2383  */
HIDDEN void toyota_print(register struct region *rp, void *dp)
Definition: sh_toyota.c:261
struct xray a_ray
Actual ray to be shot.
Definition: raytrace.h:1583
struct mfuncs toyota_mfuncs[]
Definition: sh_toyota.c:112
void bu_log(const char *,...) _BU_ATTR_PRINTF12
Definition: log.c:176
HIDDEN int toyota_render(register struct application *ap, const struct partition *pp, struct shadework *swp, void *dp)
Definition: sh_toyota.c:2239
fastf_t beta
Definition: sh_toyota.c:61
fastf_t homogenous_sky_lum(fastf_t *Sky_elmt, fastf_t *Sun, fastf_t t_vl)
Definition: sh_toyota.c:339
#define NCOLOR
fastf_t alpha
Definition: sh_toyota.c:61
HIDDEN int tmirror_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_toyota.c:223
#define MF_MAGIC
Definition: magic.h:205
fastf_t zenith_luminance(fastf_t sun_alt, fastf_t t_vl)
Definition: sh_toyota.c:304
#define VSET(a, b, c, d)
Definition: color.c:53
HIDDEN int tglass_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_toyota.c:242
#define VSETALL(a, s)
Definition: color.c:54
fastf_t sun_radiance(fastf_t lambda, fastf_t alpha, fastf_t beta, fastf_t sun_alt, fastf_t sun_sang)
Definition: sh_toyota.c:1694
fastf_t absorp_coeff(fastf_t lambda, char *material)
Definition: sh_toyota.c:1781
#define M_PI
Definition: fft.h:35
Header file for the BRL-CAD common definitions.
#define SPREAD
const char * reg_name
Identifying string.
Definition: raytrace.h:539
fastf_t overcast_sky_lum(fastf_t lz, fastf_t *Zenith, fastf_t *Sky_elmt)
Definition: sh_toyota.c:322
#define NSIRRAD
fastf_t sun_sang
Definition: sh_toyota.c:63
#define RDEBUG_RAYPLOT
Definition: optical.h:141
#define MIKE_TOL
Definition: sh_toyota.c:55
fastf_t wavelength
Definition: sh_toyota.c:60
#define HIDDEN
Definition: common.h:86
vect_t Zenith
Definition: sh_toyota.c:66
void bu_struct_print(const char *title, const struct bu_structparse *parsetab, const char *base)
Definition: parse.c:1221
void * bu_malloc(size_t siz, const char *str)
Definition: malloc.c:314
fastf_t fresnel_refl(fastf_t cos_eps, fastf_t n1, fastf_t n2)
Definition: sh_toyota.c:1737
#define CLEAR_SKY
Definition: sh_toyota.c:51
HIDDEN void toyota_free(void *cp)
Definition: sh_toyota.c:268
int bu_strncmp(const char *string1, const char *string2, size_t n)
Definition: str.c:191
#define RI_AIR
Definition: sh_toyota.c:120
struct rt_i * a_rt_i
this librt instance
Definition: raytrace.h:1588
#define BU_CK_VLS(_vp)
Definition: vls.h:69
#define OVERCAST_SKY
Definition: sh_toyota.c:53
int rti_nlights
number of light sources
Definition: raytrace.h:1760
#define bu_strlcpy(dst, src, size)
Definition: str.h:60
#define BU_GET(_ptr, _type)
Definition: malloc.h:201
fastf_t * refl
Definition: sh_toyota.c:68
void spectral_dist_table(fastf_t lambda, fastf_t *e_mean, fastf_t *v1, fastf_t *v2)
Definition: sh_toyota.c:1514
fastf_t skylight_spectral_dist(fastf_t lambda, fastf_t *Zenith, fastf_t *Sky_elmt, fastf_t *Sun, int weather, fastf_t t_vl)
Definition: sh_toyota.c:1603
#define NABSORP
#define UNUSED(parameter)
Definition: common.h:239
fastf_t index_refrac
Definition: sh_toyota.c:64
#define BU_PUT(_ptr, _type)
Definition: malloc.h:215
goto out
Definition: nmg_mod.c:3846
Definition: analyze.c:106
#define BU_STRUCTPARSE_FUNC_NULL
Definition: parse.h:153
HIDDEN int toyota_setup(register struct region *rp, struct bu_vls *matparm, void **dpp, const struct mfuncs *mfp, struct rt_i *rtip)
Definition: sh_toyota.c:136
ustring alpha
void pl_color(register FILE *plotfp, int r, int g, int b)
Definition: plot3.c:325
vect_t r_dir
Direction of ray (UNIT Length)
Definition: raytrace.h:219
void pdv_3line(register FILE *plotfp, const fastf_t *a, const fastf_t *b)
Definition: plot3.c:642
char material[128]
Definition: sh_toyota.c:67
#define MEDIUM_SKY
Definition: sh_toyota.c:52
fastf_t ozone_absorption(fastf_t lambda)
Definition: sh_toyota.c:1431
struct bu_structparse toyota_parse[]
Definition: sh_toyota.c:75
void bn_vec_ortho(vect_t out, const vect_t in)
fastf_t atmos_irradiance(fastf_t lambda)
Definition: sh_toyota.c:394
int bu_struct_parse(const struct bu_vls *in_vls, const struct bu_structparse *desc, const char *base, void *data)
Definition: parse.c:878
void lambda_to_rgb(fastf_t lambda, fastf_t irrad, fastf_t *rgb)
Definition: sh_toyota.c:1941
#define CL_O(m)
Definition: sh_toyota.c:73
fastf_t air_mass(fastf_t in_gamma)
Definition: sh_toyota.c:284
fastf_t reflectance(fastf_t lambda, fastf_t alpha, fastf_t *refl, int lines)
Definition: sh_toyota.c:1843
fastf_t atmos_trans
Definition: sh_toyota.c:65
fastf_t background_light(fastf_t lambda, struct toyota_specific *ts, fastf_t *Refl, fastf_t *Sun, fastf_t t_vl, struct shadework *swp)
Definition: sh_toyota.c:2103
Definition: vls.h:56
void bu_bomb(const char *str) _BU_ATTR_NORETURN
Definition: bomb.c:91
double fastf_t
Definition: defines.h:300
Header file for the BRL-CAD Optical Library, LIBOPTICAL.
fastf_t clear_sky_lum(fastf_t lz, fastf_t *Sky_elmt, fastf_t *Sun, fastf_t *Zenith)
Definition: sh_toyota.c:356
int rdebug
Definition: init.c:39