public class LandmarkColorBlendInterpolation extends java.lang.Object implements ColorBlend
ColorBlend instance that takes as input a set of "landmark" Color objects and corresponding values between them.
For a given value, it interpolates between the two landmarks values than lower bound and upper bound the input. The interpolation is by default
linear. However, it can also be specified to first find the normalized distance between the bounding landmark values and raise it to a power, which
may produce more obvious perceptual changes to small changes in value.| Modifier and Type | Field and Description |
|---|---|
protected java.util.List<java.awt.Color> |
landmarkColors
The landmark colors
|
protected java.util.List<java.lang.Double> |
landmarkValues
The value position of each landmark
|
protected java.util.List<java.lang.Double> |
originalLandmarkValues
The original set landmark values set before any rescaling was performed.
|
protected double |
polyDegree
The power to raise the normalized distance
|
| Constructor and Description |
|---|
LandmarkColorBlendInterpolation() |
LandmarkColorBlendInterpolation(double polyDegree)
Initializes the color blend with a power to raise the normalized distance of values.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addNextLandMark(double val,
java.awt.Color c)
Adds the next landmark between which interpolation should occur.
|
java.awt.Color |
color(double v)
Returns a
Color for a given double value |
double |
getPolynomialDegree()
Returns the power to raise the normalized distance
|
protected float |
interpolate(float s,
float e,
float t)
Returns the point that is a normalized distance t between s and e
|
void |
rescale(double minV,
double maxV)
Tells this object the minimum value and the maximum value it can receive.
|
void |
setPolynomialDegree(double polyDegree)
Sets the color blend to raise the normalized distance of values to the given degree.
|
protected java.util.List<java.lang.Double> landmarkValues
protected java.util.List<java.lang.Double> originalLandmarkValues
protected java.util.List<java.awt.Color> landmarkColors
protected double polyDegree
public LandmarkColorBlendInterpolation()
public LandmarkColorBlendInterpolation(double polyDegree)
polyDegree - the polynomial degree to use in interpolationpublic void setPolynomialDegree(double polyDegree)
polyDegree - the power to raise the normalized distancepublic double getPolynomialDegree()
public void addNextLandMark(double val,
java.awt.Color c)
val - the value of the landmarkc - the color for the landmarkpublic void rescale(double minV,
double maxV)
ColorBlendrescale in interface ColorBlendminV - the minimum valuemaxV - the maximum valuepublic java.awt.Color color(double v)
ColorBlendColor for a given double valuecolor in interface ColorBlendv - the input double valueColor for a given double valueprotected float interpolate(float s,
float e,
float t)
s - the start valuee - the end valuet - the normalized distance between s and e