MathHelper.Lerp C#(线性插值)
我在使用这个函数时遇到一个小问题,MathHelper.Lerp(float f1, float f2, float amount)
。我想要完成的是:我的程序中有一个数据表,其中包含角度和与该角度值相对应的值。当您选择表中不存在的角度时,我想使用线性插值来管理它。我想要一些东西来替换我的第一个实现,如下所示:
else if(angle >= 50 && marklast < 65)
{
DataRow row1 = table.Rows.Find(50);
DataRow row2 = table.Rows.Find(65);
someVariable = SomeMethod(row1, row2);
}
所以现在我有很多这样的 If 语句,并且想要使用 MathHelper.Lerp 的其他方法来执行此操作,问题是我我很难获得该功能,金额是多少?您会为了我的实施而以一种好的方式修改它吗?
I'm having a small problem with this function, MathHelper.Lerp(float f1, float f2, float amount)
. What I'm trying to accomplish is this: I'm having a DataTable in my program with angles and a value correspinding towards this angle value. When you choose an angle not present in the Table I want to use Linear Interpolation to manage this. I want something to replace my first implementation of this which looked like this:
else if(angle >= 50 && marklast < 65)
{
DataRow row1 = table.Rows.Find(50);
DataRow row2 = table.Rows.Find(65);
someVariable = SomeMethod(row1, row2);
}
So now I have a lot of these If statments and would like an other way of doing this with the MathHelper.Lerp
, problem is I'm having a hard time getting the function, what is amount? And would you modify this in a good way for my implementation?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
金额是 0..1 范围内的值。
我不确定你想要做什么...我认为是这样的:
Amount is a value in 0..1 range.
I'm not sure you want to do... I think is something like this: