Package org.evoludo.simulator
Class ColorMapCSS.GradientND
- Enclosing class:
ColorMapCSS
N
dimensional color gradient with one color for each dimension.-
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
Fields inherited from class ColorMap.GradientND
bg, traits, weights
-
Constructor Summary
ConstructorsConstructorDescriptionGradientND
(Color[] colors) ConstructN
dimensional color gradient to representN
dimensional data values.GradientND
(Color[] colors, int idx) ConstructN
dimensional color gradient to representN+1
dimensional data values where one data value is dependent on the other two.GradientND
(Color[] colors, Color bg) ConstructN
dimensional color gradient to representN
dimensional data with a background color other than black, or, to representN+1
dimensional data values where one data value is dependent on the otherN
. -
Method Summary
Modifier and TypeMethodDescriptioncolor2Color
(Color color) Utility method to convert thecolor
into a color object of typeT
.toGradient1D
(int nIncr) Convert theN
-dimensional color map into a 1D gradient with a total ofnIncr
shades.translate
(double[] data) Translate the multi-traitdouble[]
arraydata
to a color.Methods inherited from class ColorMap.GradientND
translate, translate
Methods inherited from class ColorMap.Gradient2D
binOf, binOf, setColor, setColor, setRange, setRange, setRange, setRange, translate
Methods inherited from class ColorMap.Gradient
interpolateColors, interpolateColors, translate
Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, translate, translate
-
Constructor Details
-
GradientND
ConstructN
dimensional color gradient to representN
dimensional data values. Each dimensioni
spans 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
ConstructN
dimensional color gradient to representN
dimensional data with a background color other than black, or, to representN+1
dimensional data values where one data value is dependent on the otherN
.The color gradient in each dimension
i
ranges frombg
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 theN
dimensionsbg
- the color representing the background (or anN+1
, dependent trait)- See Also:
-
GradientND
ConstructN
dimensional color gradient to representN+1
dimensional 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 dimensioni
ranges 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 theN
dimensionsidx
- the index of the dependent trait- See Also:
-
-
Method Details
-
translate
Translate the multi-traitdouble[]
arraydata
to a color. The type of object returned depends on the implementation.GradientND: color gradients are generated on the fly.
- Overrides:
translate
in classColorMap.Gradient2D<String>
- Parameters:
data
- thedouble[]
array to convert to a color- Returns:
- CSS style color string of the corresponding gradient color
-
color2Color
Description copied from class:ColorMap
Utility method to convert thecolor
into a color object of typeT
.- Specified by:
color2Color
in classColorMap<String>
- Parameters:
color
- the color to convert- Returns:
- the color represented as an object of type
T
-
toGradient1D
Description copied from class:ColorMap.GradientND
Convert theN
-dimensional color map into a 1D gradient with a total ofnIncr
shades. This is useful for coloring schemes that are based on an aggregate characteristics, such as the distance, instead of theN
-dimensional data.- Specified by:
toGradient1D
in classColorMap.GradientND<String>
- Parameters:
nIncr
- the total number of color increments- Returns:
- the 1D color gradient
-