Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Add function math.lerp #86

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

RFC: Add function math.lerp #86

wants to merge 3 commits into from

Conversation

zeux
Copy link
Contributor

@zeux zeux commented Dec 11, 2024

Rendered link

Closes #54 (by replacing it)

@petrihakkinen
Copy link
Contributor

Good stuff! I support the addition of math.lerp but I haven't had time to read through the details yet. However, we'd be even more interested in vector.lerp because the performance gap between a built-in and Lua implementation is likely much larger. This is a bit tangentual to the RFC, but I think we should consider whether math.lerp and vector.lerp can share the same properties (exactness, monotonicity, etc.). For example, is it possible to guarantee them and still have a performant implementation using simd math. And what would it mean in practice if vector.lerp and math.lerp have different properties (other than internal precision).

@zeux
Copy link
Contributor Author

zeux commented Dec 11, 2024

The considerations wrt numerical properties are the same and can be achieved with the same implementation, with comparable performance (the extra cost is similarly small and the delta is likely outweighed by fastcall cost in VM implementations). With vector lerp there's a question as to whether the lerp factor is a scalar or a vector itself; this doesn't change the numerics but does change the interface. However, this is not related to math.lerp so I'll leave other people to explore this in other RFCs :)

@petrihakkinen
Copy link
Contributor

petrihakkinen commented Dec 11, 2024

there's a question as to whether the lerp factor is a scalar or a vector itself

I guess ideally both would be supported. But yes, let's leave it for another RFC :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants