HyperspaceExplorer 0.7.1
Public Member Functions | Private Member Functions | Private Attributes
xyz2RGBColorManager Class Reference

maps x, y, z in parameter space to R, G, B More...

#include <ColorManager.h>

Inheritance diagram for xyz2RGBColorManager:
Inheritance graph
[legend]
Collaboration diagram for xyz2RGBColorManager:
Collaboration graph
[legend]

List of all members.

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.

Detailed Description

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.


Constructor & Destructor Documentation

xyz2RGBColorManager::xyz2RGBColorManager ( Displayable _f) [inline]

Given a Function to manage, construct a xyz2RGBColorManager.

Parameters:
_fFunction to manage

Member Function Documentation

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:

\begin{eqnarray*} R^1 & = & (R_2-R_1)*\frac{x-x_1}{x_2-x_1}+R_1 \\ R^2 & = & (R_3-R_1)*\frac{x-x_1}{x_3-x_1}+R_1 \\ \ldots \\ R^{10} & = & (R_5-R_4)*\frac{x-x_4}{x_5-x_4}+R_4 \end{eqnarray*}

The interpolated $ R $ value is the average of the temporary $ R $ values.

Analogous for $ G $ in $ y $, $ B $ in $ z $, and $ \alpha $ in $ w $.

Parameters:
xfour-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().

Here is the call graph for this function:

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

Parameters:
xpoint whose neighbors are wanted
numnumber of neighboring points
Returns:
two vectors containing the closest points and their distances to x

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().

Here is the call graph for this function:

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

Parameters:
xfour-dimensional coordinate for which the color is sought

Implements ColorManager.

void xyz2RGBColorManager::setFunction ( Displayable _f) [virtual]

set the managed Function

Parameters:
_fnew Function to manage

Reimplemented from ColorManager.

References ColorManagerManager::setFunction().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends

Generated on Mon Apr 9 2012 20:25:19 for HyperspaceExplorer 0.7.1 by doxygen 1.7.4  -  Hosted bySourceForge.net Logo