arbeit
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Compound List | File List | Namespace Members | Compound Members | File Members

TFParams.h

Go to the documentation of this file.
00001 //------------------------------------------------------------------------
00002 //
00003 //   Joe Kniss
00004 //     3-20-03
00005 //                   ________    ____   ___ 
00006 //                  |        \  /    | /  /
00007 //                  +---+     \/     |/  /
00008 //                  +--+|  |\    /|     < 
00009 //                  |  ||  | \  / |  |\  \ 
00010 //                  |      |  \/  |  | \  \ 
00011 //                   \_____|      |__|  \__\
00012 //                       Copyright  2003 
00013 //                      Joe Michael Kniss
00014 //                   <<< jmk@cs.utah.edu >>>
00015 //               "All Your Base are Belong to Us"
00016 //-------------------------------------------------------------------------
00017 
00018 // TFParams.h
00019 
00020 // Basic stuff for handling transfer functions
00021 
00022 #ifndef __TRANSFER_FUNCTION_PARAMETERS_DOT_H
00023 #define __TRANSFER_FUNCTION_PARAMETERS_DOT_H
00024 
00025 // I really hate name collisions with stupid #defs
00026 #ifdef max
00027 #  undef max
00028 #endif
00029 #ifdef min
00030 #  undef min
00031 #endif 
00032 
00033 #include <mathGutz.h>
00034 #include <vector>
00035 #include <limits>
00036 
00037 /// Simian Transfer Function namespace
00038 namespace STF { 
00039 
00040 ////////////////////////////////
00041 /// what are the max dimensions 
00042 /// of the domain and range?
00043 enum MIN_NUM_TF_PARAMS {
00044    TF_MAX_D = 10,  ///< max domain dim of tf
00045    TF_MAX_R = 10   ///< max range dim of tf 
00046 };
00047 
00048 ////////////////////////////////
00049 /// transfer function primary (scalar) data type
00050 typedef float tfSType;
00051 /// a "bad" value (NAN) for comparisons
00052 const tfSType tfSType_bad = std::numeric_limits<tfSType>::quiet_NaN();
00053 const tfSType tfSType_max = std::numeric_limits<tfSType>::max();
00054 const tfSType tfSType_min = std::numeric_limits<tfSType>::min();
00055 
00056 inline tfSType randval() { return tfSType(DRAND48); }
00057 
00058 ////////////////////////////////
00059 ///@name "Range" (output) type for tf
00060 ///@{
00061 
00062 /// this is a "vec<float,10>"
00063 typedef gutz::vec<tfSType, TF_MAX_R> tfRangeType;
00064 /// a "bad" range type for comparisons
00065 const tfRangeType tfRangeType_bad(tfSType_bad);
00066 const tfRangeType tfRangeType_max(tfSType_max);
00067 const tfRangeType tfRangeType_min(tfSType_min);
00068 
00069 typedef gutz::vec<int, TF_MAX_R> tfRangeIdx;
00070 /// All indicied in order
00071 const tfRangeIdx tfRangeIdx_ao(0,1,2,3,4,5,6,7,8,9);
00072 
00073 /// the idicies match the symantics definition below
00074 const tfRangeType tfRangeType_default(0,  ///<Red
00075                                       0,  ///<Green
00076                                       0,  ///<Blue
00077                                       0,  ///<Alpha
00078                                       0,  ///<TP Red
00079                                       0,  ///<TP Green
00080                                       0,  ///<TP Blue
00081                                       0,  ///<Frensnel
00082                                       0,  ///<Surface Scalar
00083                                       0); ///<???
00084 
00085 /// a 4 vector, since we will be dealing mostly
00086 /// with 4 value images (ex. RGBA)
00087 typedef gutz::vec<tfSType, 4> tfRangeVec4;
00088 
00089 /// a vector of RangeTypes
00090 typedef std::vector<tfRangeType> tfRangeVec;
00091 typedef tfRangeVec::iterator     tfRangeVecIter;
00092 
00093 /// useful names for TFRange indicies
00094 enum TF_RANGE_SYMANTICS {
00095    /// standard symantics
00096    RED      = 0,
00097    GREEN    = 1,
00098    BLUE     = 2,
00099    ALPHA    = 3,
00100    /// reflectance, alias for standard RGB
00101    RF_RED   = 0,
00102    RF_GREEN = 1,
00103    RF_BLUE  = 2, 
00104    /// transport (1-extinction)
00105    TP_RED   = 4,
00106    TP_GREEN = 5,
00107    TP_BLUE  = 6,
00108    /// fresnel term
00109    FRESNEL  = 7,
00110    /// surface scalar
00111    SURFACE  = 8,
00112    TFS_LAST = TF_MAX_R // == 10 for now
00113 };
00114 
00115 /// for separable 2D transfer function generation
00116 ///  used by TFElements
00117 enum TF_4MAP_KINDS {
00118    TF_RGBA
00119 };
00120 
00121 const tfRangeIdx tfRGBA_idx(0,1,2,3);
00122 
00123 ///@}
00124 
00125 
00126 
00127 ////////////////////////////////
00128 ///@name "Domain" (input/axis dims) type for tf
00129 ///@{
00130 
00131 /// this is a vec<float,10>
00132 typedef gutz::vec<tfSType, TF_MAX_D> tfDomainType;
00133 /// a bad domain type for coamparisons
00134 const tfDomainType tfDomainType_bad(tfSType_bad);
00135 const tfDomainType tfDomainType_max(tfSType_max);
00136 const tfDomainType tfDomainType_min(tfSType_min);
00137 
00138 /// vector of domain positions
00139 typedef std::vector<tfDomainType> tfDomainVec;
00140 typedef tfDomainVec::iterator     tfDomainVecIter;
00141 
00142 ////////////////////////////////
00143 /// a 2D position/Val vec
00144 /// this is a vec2<float>
00145 typedef gutz::vec2<tfSType> tfVec2;
00146 const   tfVec2              tfVec2_bad = tfVec2(tfSType_bad);
00147 
00148 ///@}
00149 
00150 
00151 } /// end namespace STF
00152 
00153 #endif
00154 

Send questions, comments, and bug reports to:
jmk