Class ColorMap.GradientND<T>
- Type Parameters:
T- type of color object: String orMeshLambertMaterialfor GWT andColorfor JRE
- Direct Known Subclasses:
ColorMap3D.GradientND,ColorMapCSS.GradientND
N dimensional data with one color for each
dimension.- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class ColorMap
ColorMap.Gradient<T>, ColorMap.Gradient1D<T>, ColorMap.Gradient2D<T>, ColorMap.GradientND<T>, ColorMap.Hue<T>, ColorMap.Index<T> -
Field Summary
FieldsModifier and TypeFieldDescription(package private) ColorThe background color.protected Color[]Reference to trait colors that provide the basis to generate gradient colors.protected double[]Temporary variable to store the weights of each color component. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedGradientND(int dim) For internal use only.GradientND(Color[] colors) ConstructNdimensional color gradient to representNdimensional data values.GradientND(Color[] colors, int idx) ConstructNdimensional color gradient to representN+1dimensional data values where one data value is dependent on the other two.GradientND(Color[] colors, Color bg) ConstructNdimensional color gradient to representNdimensional data with a background color other than black, or, to representN+1dimensional data values where one data value is dependent on the otherN. -
Method Summary
Modifier and TypeMethodDescriptionabstract ColorMap.Gradient1D<T> toGradient1D(int nIncr) Convert theN-dimensional color map into a 1D gradient with a total ofnIncrshades.booleanTranslate thedataarray ofdouble[]multi-trait values to colors and store the results in thecolorarray.booleanTranslate thedataarray ofdoublevalues to colors and store the results in thecolorarray.Methods inherited from class ColorMap.Gradient2D
binOf, binOf, setColor, setColor, setRange, setRange, setRange, setRange, translateMethods inherited from class ColorMap.Gradient
interpolateColors, interpolateColors, translateMethods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, translate, translate
-
Field Details
-
traits
Reference to trait colors that provide the basis to generate gradient colors. -
bg
Color bgThe background color. The default is black. -
weights
protected double[] weightsTemporary variable to store the weights of each color component.
-
-
Constructor Details
-
GradientND
ConstructNdimensional color gradient to representNdimensional data values. Each dimensionispans colors ranging from black tocolors[i].The default range for mapping data values onto the color gradient is
[0.0, 1.0]in all dimensions.- Parameters:
colors- the colors for each dimension- See Also:
-
GradientND
ConstructNdimensional color gradient to representNdimensional data with a background color other than black, or, to representN+1dimensional data values where one data value is dependent on the otherN.The color gradient in each dimension
iranges frombgtocolors[i].The default range for mapping data values onto the color gradient is
[0.0, 1.0]in all dimensions.- Parameters:
colors- the colors for theNdimensionsbg- the color representing the background (or anN+1, dependent trait)- See Also:
-
GradientND
ConstructNdimensional color gradient to representN+1dimensional data values where one data value is dependent on the other two. This applies, for example, to data based on the replicator equation and dynamics that unfold on the simplexSN.The index of the dependent trait is
idx. It is at its maximum if all other traits are at their minimum. The color gradient in each dimensioniranges fromcolors[idx]tocolors[i]foridx≠i.The default range for mapping data values onto the color gradient is
[0.0, 1.0]in all dimensions.- Parameters:
colors- the colors for theNdimensionsidx- the index of the dependent trait- See Also:
-
GradientND
protected GradientND(int dim) For internal use only. Allocates memory and sets the default range for mapping data values onto the color gradient to[0.0, 1.0]in every dimension.- Parameters:
dim- the dimension of the gradient colors- See Also:
-
-
Method Details
-
translate
Translate thedataarray ofdoublevalues to colors and store the results in thecolorarray. The type of thecolorarray depends on the implementation.Note: whether
datarefers to a single or multiple traits is up to the implementation to decide. For example,CXPopulationstores multiple traits in a linear array.Implementation:
- Two subsequent entries,
data[n]anddata[n+1]are converted to the corresponding gradient colors. This applies, for example, to data from continuous games with multiple traits. The gradient colors are returned in thecolorarray. - For performance reasons no validity checks on
data. In particular, all data entries must lie inside the range for mapping data values.
Implementation:
Nsubsequent entries,data[n]throughdata[n+N], are converted to gradient colors on the fly. This applies, for example, to data from continuous games withNtraits. The gradient colors are returned in thecolorarray.- For performance reasons no validity checks on
data. In particular, all data entries must lie inside the range for mapping data values.
- Overrides:
translatein classColorMap.Gradient2D<T>- Parameters:
data- thedouble[]array to convert to colorscolor- the array for the resulting colors- Returns:
trueif translation successful- See Also:
- Two subsequent entries,
-
translate
Translate thedataarray ofdouble[]multi-trait values to colors and store the results in thecolorarray. The type of thecolorarray depends on the implementation.Implementation:
- Each entry in
datarepresents a multi-dimensional trait value, which is converted to the corresponding gradient color and returned in thecolorarray. An example are trait densities in PDE models. - For performance reasons no validity checks on
data. In particular, all data entries must lie inside the range for mapping data values.
Implementation:
- Each entry in
datarepresents aN-dimensional trait value, which is converted to gradient colors on the fly and returned in thecolorarray. An example are trait densities in PDE models. - For performance reasons no validity checks on
data. In particular, all data entries must lie inside the range for mapping data values.
- Overrides:
translatein classColorMap.Gradient2D<T>- Parameters:
data- thedouble[][]array to convert to colorscolor- the array for the resulting colors- Returns:
trueif translation successful- See Also:
- Each entry in
-
toGradient1D
Convert theN-dimensional color map into a 1D gradient with a total ofnIncrshades. This is useful for coloring schemes that are based on an aggregate characteristics, such as the distance, instead of theN-dimensional data.- Parameters:
nIncr- the total number of color increments- Returns:
- the 1D color gradient
-