【发布时间】:2009-07-18 00:29:53
【问题描述】:
下面是三次插值函数:
public float Smooth(float start, float end, float amount)
{
// Clamp to 0-1;
amount = (amount > 1f) ? 1f : amount;
amount = (amount < 0f) ? 0f : amount;
// Cubicly adjust the amount value.
amount = (amount * amount) * (3f - (2f * amount));
return (start + ((end - start) * amount));
}
此函数将在给定 0.0f - 1.0f 之间的数量的情况下在开始值和结束值之间进行三次插值。如果你要绘制这条曲线,你最终会得到这样的结果:
已删除过期的 Imageshack 图像
这里的三次函数是:
amount = (amount * amount) * (3f - (2f * amount));
如何调整它以产生两条进出切线?
要产生这样的曲线:(线性开始到立方结束)
已删除过期的 Imageshack 图像
作为一个功能
和另一个一样:(立方开始到线性结束)
已删除过期的 Imageshack 图像
有人有什么想法吗?提前致谢。
【问题讨论】:
-
投票结束这个问题,因为它依赖图像来显示问题/问题是什么,而这些图像显然早已不复存在。这样的问题(在我看来)没有价值,答案也没有,因为没有人知道这些答案会回答什么问题。
标签: c# math linear-interpolation bicubic