- changed status to resolved
GradientLookup class throws exception if instantiated with no parameters.
Issue #32
resolved
The DemoOneEightGauge demo will demonstrate this, because the OneEightGauge class constructors create a GradientLookup() with to parameters.
No gradients are passed, and when you run the demo it throws an exception because the init() tries to use data that doesn't exist.
I changed the init() to be the following and it seemed to resolve the problem: private void init() { double minFraction =0 ; double maxFraction = 1;
if (!stops.isEmpty())
{
minFraction = stops.keySet().stream().mapToDouble(offset -> offset).min().getAsDouble();
maxFraction = stops.keySet().stream().mapToDouble(offset -> offset).max().getAsDouble();
}
if (minFraction > 0) { stops.put(0.0, new Stop(0.0, stops.get(minFraction).getColor())); }
if (maxFraction < 1) { stops.put(1.0, new Stop(1.0, stops.get(maxFraction).getColor())); }
}
Comments (1)
-
repo owner - Log in to comment
Should be fixed with Enzo-0.2.5