@Override public Vec2f apply(Double input) { if (input == null) return new Vec2f(0, 0); float n = (float) normalize.apply(input.doubleValue()); if (center == Float.NEGATIVE_INFINITY) return new Vec2f(0, n); else if (center == Float.POSITIVE_INFINITY) return new Vec2f(1 - n, n); else { float l = n - center; return new Vec2f(center - l, n); } }
/** * @param center * @param normalize */ public Value2BarConverter(double center, IDoubleFunction normalize) { this.center = (float) normalize.apply(center); this.normalize = normalize; }