【发布时间】:2013-12-10 06:35:36
【问题描述】:
这是我目前的情况:
我有一个二维均匀网格点,其中每个点都有一个关联的浮点值。7---2| . |2---1
我可以使用双线性插值对这些点之间的值进行插值:
public float GetValue(float x, float y, float topLeft, float topRight,
float bottomLeft, float bottomRight)
{
return topLeft*(1-x)*(1-y) + topRight*x*(1-y) +
bottomLeft*(1-x)*y + bottomRight*x*y;
}
现在我需要为每个点添加一个权重,以确定其对周围区域的影响程度。
例如:如果所有 4 个点的权重值相同,则这些权重会相互抵消,插值将返回与未加权版本完全相同的值。
现在假设所有点的权重为 1,除了左下角的权重值为 2 的点。在这种情况下,它的值对插值的影响是其他值的两倍,并且插值将转向有利于位于左下角的值。
基本上我正在尝试实现这样的方法:
public float GetValue(float x, float y, float topLeftValue, topLeftWeight,
float topRightValue, float topRightWeight,
float bottomLeftValue, float bottomLeftWeight,
float bottomRightValue, float bottomRightWeight)
{
return ?
}
有什么想法可以做到这一点吗?是否有考虑加权角值的方程/算法或双线性插值方法的修改?
感谢您的帮助!
【问题讨论】:
-
因此,将权重乘以值并在双线性插值中使用这些值。
标签: c# math interpolation