obj-c 两个数字之间的线性插值
只是想知道是否已经实现了一些方法来处理基础/Xcode 附带的其他内容中两个数字之间的线性插值?自己实现并不是一件高级的事情,但我通常发现自己重新实现已经实现的东西,并且使用已经存在的功能很好(而且它更加标准化)。
所以我想要的是这样的:
lerp(number1, number2, numberBetween0And1);
// Example:
lerp(0.0, 10.0, .5); // returns 5.0
它存在吗?
Just wondering if there are methods already implemented for handling linear interpolation between two numbers in foundation/something else that comes with Xcode? It's hardly an advanced thing to implement yourself, but I usually find myself reimplementing things that have already been implemented, and it's nice to use functionality that already exists (plus it's more standardized).
So what I'd like is something like this:
lerp(number1, number2, numberBetween0And1);
// Example:
lerp(0.0, 10.0, .5); // returns 5.0
Does it exist?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不,但这是一句简单的话:
No, but it's an easy one-liner: