Class ColorMap.GradientND<T>
- Type Parameters:
T
- type of color object: String orMeshLambertMaterial
for GWT andColor
for 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
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
GradientND
(int dim) For internal use only.GradientND
(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 TypeMethodDescriptionabstract ColorMap.Gradient1D
<T> toGradient1D
(int nIncr) Convert theN
-dimensional color map into a 1D gradient with a total ofnIncr
shades.boolean
Translate thedata
array ofdouble[]
multi-trait values to colors and store the results in thecolor
array.boolean
Translate thedata
array ofdouble
values to colors and store the results in thecolor
array.Methods inherited from class ColorMap.Gradient2D
binOf, binOf, setColor, setColor, setRange, setRange, setRange, setRange, translate, translate
Methods inherited from class ColorMap.Gradient
interpolateColors, interpolateColors, translate
Methods 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
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:
-
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 thedata
array ofdouble
values to colors and store the results in thecolor
array. The type of thecolor
array depends on the implementation.Note: whether
data
refers to a single or multiple traits is up to the implementation to decide. For example,CXPopulation
stores 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 thecolor
array. - For performance reasons no validity checks on
data
. In particular, all data entries must lie inside the range for mapping data values.
Implementation:
N
subsequent entries,data[n]
throughdata[n+N]
, are converted to gradient colors on the fly. This applies, for example, to data from continuous games withN
traits. The gradient colors are returned in thecolor
array.- For performance reasons no validity checks on
data
. In particular, all data entries must lie inside the range for mapping data values.
- Overrides:
translate
in classColorMap.Gradient2D<T>
- Parameters:
data
- thedouble[]
array to convert to colorscolor
- the array for the resulting colors- Returns:
true
if translation successful- See Also:
- Two subsequent entries,
-
translate
Translate thedata
array ofdouble[]
multi-trait values to colors and store the results in thecolor
array. The type of thecolor
array depends on the implementation.Implementation:
- Each entry in
data
represents a multi-dimensional trait value, which is converted to the corresponding gradient color and returned in thecolor
array. 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
data
represents aN
-dimensional trait value, which is converted to gradient colors on the fly and returned in thecolor
array. 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:
translate
in classColorMap.Gradient2D<T>
- Parameters:
data
- thedouble[][]
array to convert to colorscolor
- the array for the resulting colors- Returns:
true
if translation successful- See Also:
- Each entry in
-
toGradient1D
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.- Parameters:
nIncr
- the total number of color increments- Returns:
- the 1D color gradient
-