Description

Definition of a color map.

#include <ChColormap.h>

Classes

struct  Files
 Names of colormap definition files. More...
 

Public Types

enum  Type {
  BLACK_BODY, BLUE, BROWN, COPPER,
  FAST, INFERNO, JET, KINDLMANN,
  PLASMA, RED_BLUE, REGOLITH, VIRIDIS
}
 Colormap type. More...
 

Public Member Functions

 ChColormap (Type type)
 Construct a colormap of specified type.
 
void Load (Type type)
 Load data for the specified colormap, replacing current data. More...
 
ChColor Get (double value) const
 Return a color corresponding to the provided value, assumed in [0,1]. More...
 
ChColor Get (double value, double vmin, double vmax) const
 Return a color corresponding to the provided value, assumed in [vmin,vmax]. More...
 
void ArchiveOut (ChArchiveOut &archive_out)
 Method to allow serialization of transient data to archives.
 
void ArchiveIn (ChArchiveIn &archive_in)
 Method to allow de-serialization of transient data from archives.
 

Static Public Member Functions

static const std::string & GetDataFilename (Type type)
 Return the image filename for the specified colormap type.
 
static const std::string & GetImageFilename (Type type)
 Return the image filename for the specified colormap type.
 
static const std::unordered_map< Type, Files > & GetFilenames ()
 Return the list of specification files for all available colormaps.
 
static std::string GetTypeAsString (Type type)
 Get colormap type as string.
 

Member Enumeration Documentation

◆ Type

Colormap type.

Data obtained from https://www.kennethmoreland.com/color-advice/

Member Function Documentation

◆ Get() [1/2]

ChColor chrono::ChColormap::Get ( double  value) const

Return a color corresponding to the provided value, assumed in [0,1].

The output color is obtained by linear interpolation in the current colormap table. Out of range input values are clamped to [0,1]. If no colormap data was loaded, a uniform gray is returned.

◆ Get() [2/2]

ChColor chrono::ChColormap::Get ( double  value,
double  vmin,
double  vmax 
) const

Return a color corresponding to the provided value, assumed in [vmin,vmax].

The output color is obtained by linear interpolation in the current colormap table. Out of range input values are clamped to [vmin,vmax].

◆ Load()

void chrono::ChColormap::Load ( Type  type)

Load data for the specified colormap, replacing current data.

The data file is located in the Chrono data directory. If it cannot be opened, the current data is kept.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono/assets/ChColormap.h
  • /builds/uwsbel/chrono/src/chrono/assets/ChColormap.cpp