catmullromfilter.java
来自「Sunflow是一个照片级的渲染系统」· Java 代码 · 共 24 行
JAVA
24 行
package org.sunflow.core.filter;
import org.sunflow.core.Filter;
public class CatmullRomFilter implements Filter {
public float getSize() {
return 4.0f;
}
public float get(float x, float y) {
return catrom1d(x) * catrom1d(y);
}
private float catrom1d(float x) {
x = Math.abs(x);
float x2 = x * x;
float x3 = x * x2;
if (x >= 2)
return 0;
if (x < 1)
return 3 * x3 - 5 * x2 + 2;
return -x3 + 5 * x2 - 8 * x + 4;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?