VAPOR3 3.9.4
TFInterpolator.h
Go to the documentation of this file.
1//************************************************************************
2// *
3// Copyright (C) 2004 *
4// University Corporation for Atmospheric Research *
5// All Rights Reserved *
6// *
7//************************************************************************/
8//
9// File: TFInterpolator.h
10//
11// Author: Alan Norton
12// National Center for Atmospheric Research
13// PO 3000, Boulder, Colorado
14//
15// Date: November 2004
16//
17// Description: Defines the TFInterpolator class:
18// A class to interpolate transfer function values
19// Currently only supports linear interpolation
20//
21#ifndef TFINTERPOLATOR_H
22#define TFINTERPOLATOR_H
23#include <iostream>
24#include <cmath>
25
26#include <vapor/common.h>
27
28namespace VAPoR {
30public:
32
33 // Default is linear
34 enum type {
35 linear, // linearHSV
42 linearLCH
43 };
44 // Determine the interpolated value at intermediate value 0<=r<=1
45 // where the value at left and right endpoint is known
46 // This method is just a stand-in until we get more sophistication
47 //
48 static float interpolate(type, float leftVal, float rightVal, float r);
49
50 // Linear interpolation for circular (hue) fcn. values in [0,1).
51 // If it's closer to go around 1, then do so
52 //
53 static float interpCirc(type t, float leftVal, float rightVal, float r);
54
64 static float *genDivergentMap(float rgb1[3], float rgb2[3], int numColors);
65
66 // private:
67
77 static int divergentInterpolation(float rgb1[3], float rgb2[3], float output[3], float interp, bool corrective = false);
78
87 static void correctiveDivergentInterpolation(float rgb1[3], float rgb2[3], float output[3], float interp);
88
96 static float adjustHue(float m1, float s1, float h1, float m2);
97
102 static int msh2srgb(float msh[3], float rgb[3]);
103
108 static int msh2lab(float msh[3], float lab[3]);
109
114 static int lab2srgb(float lab[3], float rgb[3]);
115
120 static int srgb2msh(float rgb[3], float msh[3]);
121
126 static int srgb2lab(float rgb[3], float lab[3]);
127
132 static int lab2msh(float lab[3], float msh[3]);
133
138 static int srgb2xyz(float rgb[3], float xyz[3]);
139
144 static int xyz2srgb(float xyz[3], float rgb[3]);
145
150 static int rgb2srgb(float rgb[3], float srgb[3]);
151
156 static int srgb2rgb(float srgb[3], float rgb[3]);
157
158 static int rgb2hsv(float rgb[3], float hsv[3]);
159 static int hsv2rgb(float hsv[3], float rgb[3]);
160
161 static float Xn;
162 static float Yn;
163 static float Zn;
164 static float XYZtransferMatrix[9];
165 static float XYZinverseMatrix[9];
166 static float *colorMap;
167};
168
169}; // namespace VAPoR
170
171#endif // TFINTERPOLATOR_H
static int divergentInterpolation(float rgb1[3], float rgb2[3], float output[3], float interp, bool corrective=false)
static int xyz2srgb(float xyz[3], float rgb[3])
static float interpCirc(type t, float leftVal, float rightVal, float r)
static int rgb2hsv(float rgb[3], float hsv[3])
static void correctiveDivergentInterpolation(float rgb1[3], float rgb2[3], float output[3], float interp)
static float interpolate(type, float leftVal, float rightVal, float r)
static int hsv2rgb(float hsv[3], float rgb[3])
static int rgb2srgb(float rgb[3], float srgb[3])
static int srgb2msh(float rgb[3], float msh[3])
static float * colorMap
static int srgb2rgb(float srgb[3], float rgb[3])
static int srgb2xyz(float rgb[3], float xyz[3])
static int msh2lab(float msh[3], float lab[3])
static float adjustHue(float m1, float s1, float h1, float m2)
static int msh2srgb(float msh[3], float rgb[3])
static int lab2msh(float lab[3], float msh[3])
static int lab2srgb(float lab[3], float rgb[3])
static float * genDivergentMap(float rgb1[3], float rgb2[3], int numColors)
static int srgb2lab(float rgb[3], float lab[3])
#define PARAMS_API
Definition: common.h:77