HyperspaceExplorer 0.7.1
|
maps x, y, z in parameter space to R, G, B More...
#include <ColorManager.h>
Public Member Functions | |
xyz2RGBColorManager (Displayable *_f) | |
Given a Function to manage, construct a xyz2RGBColorManager. | |
virtual void | setFunction (Displayable *) |
set the managed Function | |
virtual void | calibrateColor (const VecMath::Vector< 4 > &x, const Color &_col=Color()) |
Point (x, y, z) has color col. This may serve for interpolation. | |
virtual Color | getColor (const VecMath::Vector< 4 > &x) |
Find the color of a given point. | |
virtual void | depthCueColor (double wmax, double wmin, double w, const VecMath::Vector< 4 > &) |
post-process color at given point to have 4D depth cue | |
virtual std::string | getContents () |
debugging output | |
Private Member Functions | |
Color | computeColorFromNeighbors (const VecMath::Vector< 4 > &x) |
Interpolate the color of a point from the colors of its neighbors. | |
std::pair< std::vector < VecMath::Vector < 4 > >, std::vector< double > > | findClosestPoints (const VecMath::Vector< 4 > &, unsigned=5) |
find the closest points in the map of colors | |
Color | averageColors (const std::vector< Color > &) |
Find the average RGBA values from the list of Colors supplied. | |
Private Attributes | |
colormap | col |
Here the colors for defined points re stored. |
maps x, y, z in parameter space to R, G, B
This algorithm stores every point in a std::map<Vector<4>, Color> for reference and if necessary interpolates between stored points.
The algorithm is rather inefficient because of high lookup times in a std::map<Vector<>, anything> - Vector<>s are ordered by their norm, which necessitates a s**tload of floating point multiplications.
Use the simpler Fastxyz2RGBColorManager. Its only drawback is that it does not allow for 4D depth cue yet. This class is kept only for reference and may be removed at any time.
xyz2RGBColorManager::xyz2RGBColorManager | ( | Displayable * | _f | ) | [inline] |
Given a Function to manage, construct a xyz2RGBColorManager.
_f | Function to manage |
Color xyz2RGBColorManager::computeColorFromNeighbors | ( | const VecMath::Vector< 4 > & | x | ) | [private] |
Interpolate the color of a point from the colors of its neighbors.
The RGBA values are interpolated from a list of five neighboring points, because in four dimensions you need five points to enclose a given point.
This gives 10 values:
The interpolated value is the average of the temporary values.
Analogous for in , in , and in .
x | four-dimensional coordinate for which the color is sought |
References std::pair< _T1, _T2 >::first, std::vector< _Tp, _Alloc >::push_back(), std::pair< _T1, _T2 >::second, and std::vector< _Tp, _Alloc >::size().
std::pair< vector< Vector< 4 > >, vector< double > > xyz2RGBColorManager::findClosestPoints | ( | const VecMath::Vector< 4 > & | x, |
unsigned | num = 5 |
||
) | [private] |
find the closest points in the map of colors
x | point whose neighbors are wanted |
num | number of neighboring points |
References std::vector< _Tp, _Alloc >::back(), std::vector< _Tp, _Alloc >::begin(), distance(), std::vector< _Tp, _Alloc >::empty(), std::vector< _Tp, _Alloc >::insert(), std::make_pair(), min(), num, std::vector< _Tp, _Alloc >::push_back(), std::vector< _Tp, _Alloc >::size(), and VecMath::sqnorm().
Color xyz2RGBColorManager::getColor | ( | const VecMath::Vector< 4 > & | x | ) | [virtual] |
Find the color of a given point.
If the point is not stored in the map of already defined points, calculate its color by averaging over the nearest neighboring points and store its value for future use
x | four-dimensional coordinate for which the color is sought |
Implements ColorManager.
void xyz2RGBColorManager::setFunction | ( | Displayable * | _f | ) | [virtual] |
set the managed Function
_f | new Function to manage |
Reimplemented from ColorManager.
References ColorManagerManager::setFunction().