spectrum.h

Go to the documentation of this file.
00001 /*                      S P E C T R U M . H
00002  * BRL-CAD
00003  *
00004  * Copyright (c) 2004-2006 United States Government as represented by
00005  * the U.S. Army Research Laboratory.
00006  *
00007  * This library is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * This library is distributed in the hope that it will be useful, but
00013  * WITHOUT ANY WARRANTY; without even the implied warranty of
00014  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015  * Library General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with this file; see the file named COPYING for more
00019  * information.
00020  */
00021 /** @addtogroup libmultispectral */
00022 /*@{*/
00023 /** @file spectrum.h
00024  *
00025  *  A header file containing data structures to assist with
00026  *  recording spectral data.
00027  *  The overall notion is that each spectral sample should be
00028  *  as compact as possible (typically just an array of power levels),
00029  *  with all the context stored in one place.
00030  *
00031  *  The context is kept in an 'bn_table' structure, and
00032  *  the data for one particular sample are kept in an 'bn_tabdata'
00033  *  structure.
00034  *  tabdata.h provides the data structures,
00035  *  librt/tabdata.c provides the routines.
00036  *
00037  *  The contents of the spectral sample in val[j] are interpreted
00038  *  in the interval (wavel[j]..wavel[j+1]).
00039  *  This value could be power, albedo, absorption, refractive index,
00040  *  or any other wavelength-specific parameter.
00041  *
00042  *  For example, if the val[] array contains power values, then
00043  *  val[j] contains the integral of the power from wavel[j] to wavel[j+1]
00044  *
00045  *  As an exmple, assume nwave=2, wavel[0]=500, wavel[1]=600, wavel[2]=700.
00046  *  Then val[0] would contain data for the 500 to 600nm interval,
00047  *  and val[1] would contain data for the 600 to 700nm interval.
00048  *  There would be no storage allocated for val[2] -- don't use it!
00049  *  There are several interpretations of this:
00050  *      1)  val[j] stores the total (integral, area) value for the interval, or
00051  *      2)  val[j] stores the average value across the interval.
00052  *
00053  *  The intervals need not be uniformly spaced; it is acceptable to
00054  *  increase wavelength sampling density around "important" frequencies.
00055  *  This will undoubtably complicate certain functions.
00056  *
00057  *  By convention, wavelength is stored in nanometers as an integer,
00058  *  and power is stored in Watts.
00059  *
00060  *  Wavelength Units -
00061  *      cm = 10** -2 m  centimeters
00062  *      mm = 10** -3 m  milimeters
00063  *      um = 10** -6 m  micrometers, or microns
00064  *      nm = 10** -9 m  nanometers
00065  *
00066  *  The Spectrum in nm -
00067  *      < 10 nm                 X-Rays
00068  *      10 to 390               Ultraviolet
00069  *      390 to 770              Visible
00070  *      770 to 1500             Near IR
00071  *      1500 to 6,000           Middle IR       (includes 3-5 um band)
00072  *      6,000 to 40,000         Far IR          (includes 8-12 um band)
00073  *      40,000 to 1,000,000     Extreme IR
00074  *      > 10**6 nm              Microwaves      (300 GHz to 300 MHz)
00075  *      > 10**9 nm              Radio waves     (300 MHz and down)
00076  *
00077  *  It is tempting to store the wavelength in nanometers as an integer,
00078  *  but that might preclude very narrow-band calculations, such as might
00079  *  be required to study a single spectral line,
00080  *  and it might also preclude future extensions to X-rays.
00081  *  Because there are likely to be very few bn_table structures
00082  *  in use, the extra storage isn't a likely problem.
00083  *  The worst effect of this decision will be floating-point grunge
00084  *  when printing wavelengths, e.g. 650nm might print as 649.99nm.
00085  *  On the other hand, non-integer values might make it difficult to
00086  *  determine if two wavelengths from different curves were the "same",
00087  *  without introducing a wavelength "tolerance" notion.  Ugh.
00088  *
00089  *  @author
00090  *      Michael John Muuss
00091  *
00092  *  @par Source
00093  *      The U. S. Army Research Laboratory
00094  *      Aberdeen Proving Ground, Maryland  21005-5068  USA
00095  *  $Header: /cvsroot/brlcad/brlcad/include/spectrum.h,v 14.9 2006/09/18 05:24:07 lbutler Exp $
00096  */
00097 
00098 #include "common.h"
00099 
00100 #include "bn.h"
00101 #include "raytrace.h"
00102 
00103 /*
00104  * Routines
00105  */
00106 RT_EXPORT BU_EXTERN(void                        rt_spect_make_CIE_XYZ,
00107                     (struct bn_tabdata          **x,
00108                      struct bn_tabdata          **y,
00109                      struct bn_tabdata          **z,
00110                      const struct bn_table      *tabp));
00111 
00112 RT_EXPORT BU_EXTERN(void                        rt_spect_black_body,
00113                     (struct bn_tabdata          *data,
00114                      double                     temp,
00115                      unsigned int               n));
00116 RT_EXPORT BU_EXTERN(void                        rt_spect_black_body_fast,
00117                     (struct bn_tabdata          *data,
00118                      double                     temp));
00119 
00120 RT_EXPORT BU_EXTERN(void                        rt_spect_reflectance_rgb,
00121                     (struct bn_tabdata          *curve,
00122                      const float                rgb[3]));
00123 
00124 /*@}*/
00125 /*
00126  * Local Variables:
00127  * mode: C
00128  * tab-width: 8
00129  * c-basic-offset: 4
00130  * indent-tabs-mode: t
00131  * End:
00132  * ex: shiftwidth=4 tabstop=8
00133  */
00134 

Generated on Mon Sep 18 01:24:42 2006 for BRL-CAD by  doxygen 1.4.6