package yi.iu.processor.resample;

public class BSplineResampler extends Resampler
{
    public BSplineResampler () {
        super(); fwidth=2.0;
    }
    
    public BSplineResampler(int w, int h) {
        super(w,h); fwidth=2.0;
    }

    public double filter(double value)
    {
        double tt;

        if (value < 0.0) value = -value;

        if (value < 1.0) {
            tt = value*value;
            return 0.5*tt*value - tt + 2.0 / 3.0;
        }
        else if (value < 2.0) {
            value = 2.0 - value;
            return 1.0/6.0 * value * value * value;

        }
        else return 0.0d;
    }

}