Sha256: 2abb47d8be76b9af969fb16fb7ac43cc41ed01df2421fba96a78167e6e423256
Contents?: true
Size: 741 Bytes
Versions: 6
Compression:
Stored size: 741 Bytes
Contents
package org.sunflow.core.filter; import org.sunflow.core.Filter; public class BlackmanHarrisFilter implements Filter { @Override public float getSize() { return 4.0f; } @Override public float get(float x, float y) { return bh1d(x * 0.5f) * bh1d(y * 0.5f); } private float bh1d(float x) { if (x < -1.0f || x > 1.0f) { return 0.0f; } x = (x + 1) * 0.5f; final double A0 = 0.35875; final double A1 = -0.48829; final double A2 = 0.14128; final double A3 = -0.01168; return (float) (A0 + A1 * Math.cos(2 * Math.PI * x) + A2 * Math.cos(4 * Math.PI * x) + A3 * Math.cos(6 * Math.PI * x)); } }
Version data entries
6 entries across 6 versions & 1 rubygems