Skip to content

Commit 7cf4442

Browse files
committed
Fix exception caused by bad color range.
1 parent 70031a0 commit 7cf4442

File tree

1 file changed

+7
-6
lines changed
  • EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util

1 file changed

+7
-6
lines changed

EnrichmentMapPlugin/src/main/java/org/baderlab/csplugins/enrichmentmap/view/util/ColorUtil.java

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -126,16 +126,17 @@ public static Color interpolate(Color c1, Color c2, float t) {
126126

127127

128128
private static float interpolate(final double value, final double lowerBound, final double upperBound) {
129-
return (float) MathUtil.invLinearInterp(value, lowerBound, upperBound);
129+
double t = MathUtil.invLinearInterp(value, lowerBound, upperBound);
130+
130131
// // Linearly interpolate the value
131132
// final double f = value < 0.0 ? MathUtil.invLinearInterp(value, lowerBound, 0)
132133
// : MathUtil.invLinearInterp(value, 0, upperBound);
133134
// float t = (float) (value < 0.0 ? MathUtil.linearInterp(f, 0.0, 1.0) : MathUtil.linearInterp(f, 1.0, 0.0));
134135
//
135-
// // Make sure it's between 0.0-1.0
136-
// t = Math.max(0.0f, t);
137-
// t = Math.min(1.0f, t);
138-
//
139-
// return t;
136+
// Make sure it's between 0.0-1.0
137+
t = Math.max(0.0f, t);
138+
t = Math.min(1.0f, t);
139+
140+
return (float) t;
140141
}
141142
}

0 commit comments

Comments
 (0)