#include <SPalette.h>
Collaboration diagram for SPalette:
Public Member Functions | |
SPalette () | |
constructor | |
~SPalette () | |
destructor | |
bool | load (const char *filename) |
loads a palette definition | |
bool | save (const char *filename) |
saves a palette definition | |
bool | loadSpectrum (int rid, int lid, const char *filename) |
loads a single spectrum | |
bool | saveSpectrum (int rid, int lid, const char *filename) |
saves a single spectrum | |
void | reset () |
clears all entries for lights and reflectances | |
bool | createSpectrum () |
Creates a spectrum from the given design criteria. | |
void | setSmoothnessWeight (float weight) |
Sets m_WSmoothness. | |
void | setErrorMinWeight (float weight) |
Sets m_WErrorMin. | |
void | useV7 (bool useit=true) |
When finding a colour for a given spectrum you can make it correct in the V31 or in the V7 space. | |
void | matchDesignColours () |
sets the initial values of the design colours to the actual colours | |
dword | getNLights () const |
returns number of lights. | |
int | addLight (const vuColour31a &light) |
Add a light spectrum to the palette. | |
void | removeLight (word index) |
Remove a light spectrum from the palette. | |
dword | getNRefls () const |
returns number of lights. | |
int | addReflectance (const vuColour31a &refl) |
Add a reflectance spectrum. | |
void | removeReflectance (word index) |
Remove a reflectance spectrum from the palette. | |
vuColour31a & | getSpec (int rid, int lid) |
returns handle to a spectrum | |
bool & | useSpecBounds (int rid, int lid) |
use bounds? returns handle for bool | |
vuColour31a & | getSpecUB (int rid, int lid) |
handle to upper bound of spectrum | |
vuColour31a & | getSpecLB (int rid, int lid) |
handle to lower bound of spectrum | |
void | setSpecName (int rid, int lid, const char *name) |
set name for spectrum | |
const char * | getSpecName (int rid, int lid) |
get name of spectrum | |
bool & | getSpecDesignState (int rid, int lid) |
tell whether the spectrum should be designed (returns bool handle) | |
vuColourRGBa | getRLColour (dword rid, dword lid, bool useV7=false) |
compute the actual colour for a certain light-reflectance incidence | |
void | setDesignRGBW (dword rid, dword lid, const vuColourRGBa &col) |
Sets the desired colour for a reflectance-light combination. | |
vuColourRGBa & | getDesignRGBW (dword rid, dword lid) |
returns handle to the currently set 'design colour' | |
bool & | getDesignState (dword rid, dword lid) |
This flag indicates whether the entry should be used as a design criterium. | |
void | attachFreeColour (dword rid, dword lid, int fcid) |
Attaches a 'free colour' slot to a light-reflectance combination. | |
void | detachFreeColour (dword rid, dword lid) |
Removes an attached 'free colour' from a design node. | |
int | getFreeColourID (int rid, int lid) |
returns ID of free colour attached to a design colour | |
dword | getNFreeColour () |
Returns number of slots for 'free colours' . | |
void | setFreeColour (dword fcid, const vuColourRGBa &lb=vuColourRGBa(0.0f), const vuColourRGBa &ub=vuColourRGBa(1.0f)) |
creates a 'free colour' slot, if it doen't already exist, lb and ub can be used to make a lower and upper bound | |
vuColourRGBa & | getFreeColUB (dword fcid) |
get handle to upper bound of free colour | |
vuColourRGBa & | getFreeColLB (dword fcid) |
get handle to lower bound of free colour | |
bool & | getFreeColBoundState (dword fcid) |
should the bounds be used? (handle to flag) | |
Private Member Functions | |
SSpectrum & | getSpecRec (int rid, int lid) |
returns handle to a spectral class | |
bool | checkSetup () |
marks 'free colour'-slots that are actually used and checks design colour mask for inconsistencies. | |
SMatrix | makeErrorMat (const vuColour31a &diag) |
Returns weighted error minimizing matrix for the given spectrum. | |
SMatrix | makeSmoothingMat () |
Returns weighted smoothing matrix (31x31). | |
SMatrix | makeCXFMat (const vuColour31a &diag) |
Returns a V31tRGB matrix accumulated with the diagonal matrix of the given Spectrum. | |
SMatrix | makeCXFMat (const vuColour31a &diag, bool useV7) |
Returns a V31tRGB matrix accumulated with the diagonal matrix of the given Spectrum. | |
Private Attributes | |
vuDVector< SSpectrum > | m_Lights |
A growable array (vuDVector) of lights. | |
vuDVector< SSpectrum > | m_Refls |
A growable array (vuDVector) of reflectances. | |
vuDVector< vuDVector< SDesignColour > > | m_DesCol |
A 2D field of RGB values holding the desired values for each light*reflectance combination. | |
vuDVector< SFreeColour > | m_FreeCol |
slots for 'free' colours. | |
bool | m_UseV7 |
perform optimization using V7 colour Xform? | |
float | m_WSmoothness |
Weight for smoothness as a design criterion. | |
bool | m_UseSmoothness |
switch for whether to use smoothness or not | |
float | m_WErrorMin |
Weight for the error minimizing matrix. | |
bool | m_UseErrorMin |
switch for using the error minimizing matrix | |
SOptimizer | m_Optimizer |
The optimizer used for fitting spectra into the given criteria. | |
SMatrix | m_C31t7 |
for conversion from V31 to V7 | |
dword | m_NDesCol |
number of design colours used | |
dword | m_NDesSpec |
number of spectra used for design | |
SMatrix | m_CXF31toRGB |
colour conversion matrix. | |
SMatrix | m_CXF7toRGB |
colour conversion matrix. | |
SMatrix | m_CXF31to7 |
colour conversion matrix. |
This is a framework for designing spectra for lights and reflectances. The SOptimizer is used to find spectra fulfilling certain design criteria.
Definition at line 28 of file SPalette.h.
|
constructor
|
|
destructor
|
|
Add a light spectrum to the palette.
Referenced by vuSpecPalette::OnAddLight(), vuSpecPalette::OnLoadPal(), and vuTFDesignSpec::updatePalette(). |
|
Add a reflectance spectrum.
Referenced by vuSpecPalette::OnAddReflectance(), vuSpecPalette::OnLoadPal(), and vuTFDesignSpec::updatePalette(). |
|
Attaches a 'free colour' slot to a light-reflectance combination. The fcid is the index of the 'free colour'. If set to -1 the only the design colour will be used during optimization. Referenced by vuSpecPalette::OnDCFC(). |
|
marks 'free colour'-slots that are actually used and checks design colour mask for inconsistencies.
|
|
Creates a spectrum from the given design criteria. This function builds a matrix and solves for a (positivity constrained) least squares solution using SOptimizer. Referenced by vuSpecPalette::OnCreateSpectrum(). |
|
Removes an attached 'free colour' from a design node.
Definition at line 263 of file SPalette.h. |
|
returns handle to the currently set 'design colour'
Referenced by vuSpecPalette::OnGetAllDCColours(), vuSpecPalette::OnGetDCColour(), and vuSpecPalette::PaintColours(). |
|
This flag indicates whether the entry should be used as a design criterium.
Definition at line 254 of file SPalette.h. Referenced by vuSpecPalette::OnCBDCDesign(), vuSpecPalette::OnColourClick(), and vuSpecPalette::PaintColours(). |
|
should the bounds be used? (handle to flag)
Definition at line 285 of file SPalette.h. Referenced by vuSpecPalette::OnCBFCUseB(), and vuSpecPalette::OnDCFC(). |
|
get handle to lower bound of free colour
Definition at line 282 of file SPalette.h. |
|
returns ID of free colour attached to a design colour
Definition at line 266 of file SPalette.h. Referenced by vuSpecPalette::OnCBFCUseB(), and vuSpecPalette::OnColourClick(). |
|
get handle to upper bound of free colour
Definition at line 279 of file SPalette.h. |
|
Returns number of slots for 'free colours' .
Definition at line 272 of file SPalette.h. References dword. |
|
returns number of lights.
Definition at line 188 of file SPalette.h. References dword. Referenced by vuSpecPalette::getNLights(), vuTFDesignSpec::updateFromPalette(), and vuTFDesignSpec::updatePalette(). |
|
returns number of lights.
Definition at line 198 of file SPalette.h. References dword. Referenced by vuSpecPalette::getNRefls(), vuTFDesignSpec::updateFromPalette(), and vuTFDesignSpec::updatePalette(). |
|
compute the actual colour for a certain light-reflectance incidence
Referenced by vuSpecPalette::OnGetAllDCColours(), vuSpecPalette::OnGetDCColour(), and vuSpecPalette::PaintColours(). |
|
returns handle to a spectrum Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 211 of file SPalette.h. Referenced by vuSpecPalette::OnColourClick(), vuSpecPalette::OnCreatePlanckian(), vuSpecPalette::OnDivideScalar(), vuSpecPalette::OnMultiplyScalar(), vuSpecPalette::PaintColours(), vuSpecPalette::PaintSpectrum(), vuTFDesignSpec::updateFromPalette(), and vuTFDesignSpec::updatePalette(). |
|
tell whether the spectrum should be designed (returns bool handle) Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 241 of file SPalette.h. Referenced by vuSpecPalette::OnCBSPDesign(), and vuSpecPalette::PaintColours(). |
|
handle to lower bound of spectrum Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 226 of file SPalette.h. Referenced by vuSpecPalette::OnColourClick(), and vuSpecPalette::OnSPLowerBound(). |
|
get name of spectrum Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 236 of file SPalette.h. |
|
returns handle to a spectral class
Definition at line 293 of file SPalette.h. |
|
handle to upper bound of spectrum Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 221 of file SPalette.h. Referenced by vuSpecPalette::OnColourClick(), and vuSpecPalette::OnSPUpperBound(). |
|
loads a palette definition
Referenced by SPaled::OnInit(), and vuSpecPalette::OnLoadPal(). |
|
loads a single spectrum
Referenced by vuSpecPalette::OnLoadSP(). |
|
Returns a V31tRGB matrix accumulated with the diagonal matrix of the given Spectrum. The switch useV7 decides whether to do diagonal multiply in V7. |
|
Returns a V31tRGB matrix accumulated with the diagonal matrix of the given Spectrum.
Definition at line 307 of file SPalette.h. |
|
Returns weighted error minimizing matrix for the given spectrum.
|
|
Returns weighted smoothing matrix (31x31).
|
|
sets the initial values of the design colours to the actual colours
Referenced by vuTFDesignSpec::updatePalette(). |
|
Remove a light spectrum from the palette. Index in the list of lights. |
|
Remove a reflectance spectrum from the palette. Index in the list of reflectances. |
|
clears all entries for lights and reflectances
Referenced by vuTFDesignSpec::parseTFunc(). |
|
saves a palette definition
Referenced by vuSpecPalette::OnSavePal(). |
|
saves a single spectrum
Referenced by vuSpecPalette::OnSaveSP(). |
|
Sets the desired colour for a reflectance-light combination. The alpha value is interpreted as a weight for that colour. |
|
Sets m_WErrorMin.
Referenced by vuSpecPalette::OnErrorW(). |
|
creates a 'free colour' slot, if it doen't already exist, lb and ub can be used to make a lower and upper bound
|
|
Sets m_WSmoothness.
Referenced by vuSpecPalette::OnSmoothW(). |
|
set name for spectrum Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 231 of file SPalette.h. Referenced by vuSpecPalette::OnSPName(). |
|
use bounds? returns handle for bool Either rid or lid has to be -1, the other holds the index for the light/reflectance you're inquiring about. Definition at line 216 of file SPalette.h. Referenced by vuSpecPalette::OnCBSPUseB(). |
|
When finding a colour for a given spectrum you can make it correct in the V31 or in the V7 space. This function tells which one to use. To minimize the difference between the results of the two colour spaces use setErrorMinWeight(). Definition at line 181 of file SPalette.h. Referenced by vuSpecPalette::CreateWidgets(), and vuSpecPalette::OnCBUseV7(). |
|
for conversion from V31 to V7
Definition at line 357 of file SPalette.h. |
|
colour conversion matrix.
Definition at line 363 of file SPalette.h. |
|
colour conversion matrix.
Definition at line 361 of file SPalette.h. |
|
colour conversion matrix.
Definition at line 362 of file SPalette.h. |
|
A 2D field of RGB values holding the desired values for each light*reflectance combination. The alpha values of the colours are used as weights for the minimization. (Indexing is m_DesCol[reflID][lightID]) Definition at line 331 of file SPalette.h. |
|
slots for 'free' colours.
Definition at line 334 of file SPalette.h. |
|
A growable array (vuDVector) of lights. Use add/removeLight() for accessing this array to maintain consistence with m_DesCol. Definition at line 321 of file SPalette.h. |
|
number of design colours used
Definition at line 359 of file SPalette.h. |
|
number of spectra used for design
Definition at line 360 of file SPalette.h. |
|
The optimizer used for fitting spectra into the given criteria.
Definition at line 355 of file SPalette.h. |
|
A growable array (vuDVector) of reflectances. Use add/removeReflectance() for accessing this array to maintain consistence with m_DesCol. Definition at line 325 of file SPalette.h. |
|
switch for using the error minimizing matrix
Definition at line 352 of file SPalette.h. |
|
switch for whether to use smoothness or not
Definition at line 344 of file SPalette.h. |
|
perform optimization using V7 colour Xform?
Definition at line 337 of file SPalette.h. |
|
Weight for the error minimizing matrix. 0 - inactive. This matrix is a combination of (c31tRGB - (c7tRGB*c31t7)) for each light source. The resulting vector is an indication for the error in the 7model. Definition at line 350 of file SPalette.h. |
|
Weight for smoothness as a design criterion. 0 - inactive. Appends a 2nd derivative filter toeplitz(m_Smoothness*(-1 2 -1)...) to the optimization matrix. Definition at line 342 of file SPalette.h. |