Package org.evoludo.simulator
Class ColorMap3D
Coloring3D is a wrapper class for different schemes to map data onto colors
for 3D visualization using WebGL. Each inner class implements the
ColorMap
interface to provide an implementation agnostic manner to
translate data into colors.
The following color mappings are currently available:
- Index
- Associates integer indices with colors.
- Gradient1D
- One dimensional color gradient spanning two or more colors.
- Hue
- Special case of
Gradient1D
where the gradient follows the color hue. - Gradient2D
- Two dimensional gradient with each dimension represented by one color.
- GradientND
- Multi-dimensional gradient spanned by an identical number of colors
Important: the Parallax library provides access to WebGL technology directly from GWT. The following code is compliant with Parallax version 1.6. Unfortunately, colors are handled differently in the two frameworks. In particular, java.awt.Color and thothbot.parallax.core.shared.math.Color are incompatible. In the following any reference to Color refers to the WebGL version, while references to regular java Color's use the fully qualified name, java.awt.Color.
- Author:
- Christoph Hauert
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
One dimensional color gradient spanning two or more colorsstatic class
Two dimensional color gradient with one color for each dimension.static class
N
dimensional color gradient with one color for each dimension.static class
Color gradient following the hue.static class
Associates integer indices with colors.Nested classes/interfaces inherited from class ColorMap
ColorMap.Gradient<T>
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Color
The color black.static final Color
The baseline color of directed links.static final Color
The color of directed links at the destination.static final Color
The color of directed links at the origin.private static final double
Helper constant: the factor to derive darker shades of a color.static final Color
The color of undirected links. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Color
Color2Color
(double r, double g, double b) Convert red, green, blue to a WebGL Color object.static Color
Color2Color
(Color color) Convert a java.awt.Color object to a Color object.static MeshLambertMaterial
Color2Material
(double r, double g, double b, double a) Convert red, green, blue and transparency values (RGBA) to a WebGL Material object.static MeshLambertMaterial
Color2Material
(Color color) Convert a java.awt.Color to a WebGL Material object.Methods inherited from class ColorMap
addAlpha, addAlpha, addColors, blendColors, blendColors, color2Color, translate, translate, translate, translate, translate, translate
-
Field Details
-
BLACK
The color black. -
UNDIRECTED
The color of undirected links. -
DIRECTED
The baseline color of directed links. -
DIRECTED_SRC
The color of directed links at the origin. -
DIRECTED_DST
The color of directed links at the destination. -
FACTOR
private static final double FACTORHelper constant: the factor to derive darker shades of a color.- See Also:
-
-
Constructor Details
-
ColorMap3D
public ColorMap3D()Constructs a new color map.
-
-
Method Details
-
Color2Color
Convert a java.awt.Color object to a Color object.- Parameters:
color
- the java.awt.Color- Returns:
- the corresponding thothbot.parallax.core.shared.math.Color
-
Color2Color
Convert red, green, blue to a WebGL Color object.- Parameters:
r
- the red component of the color in[0.0, 1.0]
g
- the green component of the color in[0.0, 1.0]
b
- the blue component of the color in[0.0, 1.0]
- Returns:
- the corresponding thothbot.parallax.core.shared.math.Color object
-
Color2Material
Convert red, green, blue and transparency values (RGBA) to a WebGL Material object.- Parameters:
r
- the red component of the color in[0.0, 1.0]
g
- the green component of the color in[0.0, 1.0]
b
- the blue component of the color in[0.0, 1.0]
a
- the transparency (alpha) component of the color in[0.0, 1.0]
- Returns:
- the Material object for non-shiny surfaces representing the RGB value with transparency (if applicable)
- See Also:
-
Color2Material
Convert a java.awt.Color to a WebGL Material object. In order to enhance 3D effects the ambient color is set tocolor.darker()
.- Parameters:
color
- the java.awt.Color- Returns:
- the Material object for non-shiny surfaces with
color
and transparency (if applicable)
-