三次/五次线性插值
Cubic / Quintic linear interpolation
下面是线性插值函数:
float lerp (float a, float b, float weight) {
return a + weight * (b - a);
}
下面是三次插值函数:
float cubic (float p1, float p2, float p3, float p4, float weight) {
float m = weight * weight;
float a = p4 - p3 - p1 + p2;
float b = p1 - p2 - a;
float c = p3 - p1;
float d = p2;
return a * weight * m + b * m + c * weight + d;
}
以下方法的名称是什么?:
float lerp (float a, float b, float weight) {
float v = weight * weigth * (3.0f - 2.0f * weight);
return a + v * (b - a);
}
我看到有人将上述方法称为“三次”,但对我来说,三次插值需要 4 个点。
此外,我还看到了以下内容:
float lerp (float a, float b, float weight) {
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
return a + v * (b - a);
}
上面的代码被引用为“五次”,但我不太确定如果没有必要的额外“点”,这些函数怎么会是“三次”和“五次”。
对“权重”执行的这些操作的名称是什么?
float v = weight * weigth * (3.0f - 2.0f * weight);
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
"Cubic" 是“三次多项式”的另一种说法。
"Quintic" 是“五次多项式”的另一种说法。
参数个数无所谓。 P(x) = x*x*x
是一个“三次”多项式,即使没有参数。
What is the name of these operations performed on the "weights"?
...
这些函数称为"smoothstep"。 Smoothstep 函数是一族奇次多项式。第一个是 3 阶(或“三次”)smoothstep,第二个是 5 阶(或“quintic”)smoothstep。
下面是线性插值函数:
float lerp (float a, float b, float weight) {
return a + weight * (b - a);
}
下面是三次插值函数:
float cubic (float p1, float p2, float p3, float p4, float weight) {
float m = weight * weight;
float a = p4 - p3 - p1 + p2;
float b = p1 - p2 - a;
float c = p3 - p1;
float d = p2;
return a * weight * m + b * m + c * weight + d;
}
以下方法的名称是什么?:
float lerp (float a, float b, float weight) {
float v = weight * weigth * (3.0f - 2.0f * weight);
return a + v * (b - a);
}
我看到有人将上述方法称为“三次”,但对我来说,三次插值需要 4 个点。
此外,我还看到了以下内容:
float lerp (float a, float b, float weight) {
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
return a + v * (b - a);
}
上面的代码被引用为“五次”,但我不太确定如果没有必要的额外“点”,这些函数怎么会是“三次”和“五次”。
对“权重”执行的这些操作的名称是什么?
float v = weight * weigth * (3.0f - 2.0f * weight);
float v = weight * weight * weight * (weight * (weight * 6.0f - 15.0f) + 10.0f);
"Cubic" 是“三次多项式”的另一种说法。
"Quintic" 是“五次多项式”的另一种说法。
参数个数无所谓。 P(x) = x*x*x
是一个“三次”多项式,即使没有参数。
What is the name of these operations performed on the "weights"?
...
这些函数称为"smoothstep"。 Smoothstep 函数是一族奇次多项式。第一个是 3 阶(或“三次”)smoothstep,第二个是 5 阶(或“quintic”)smoothstep。