package yi.iu.processor.resample;

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

    public double filter(double value)
    {
        if (value < 0.0) value = -value;

        if (value < 3.0) 
            return sinC(value) * sinC(value / 3.0);
        else
            return 0.0d;
    }
    
    double sinC(double value) {
        if (value != 0.0)  {
            value = value * Math.PI;
            return Math.sin(value) / value;
        }
        return 1.0;
    }
}