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

add wrap function #2521

Merged
merged 1 commit into from
Jun 14, 2022
Merged

add wrap function #2521

merged 1 commit into from
Jun 14, 2022

Conversation

Tekkitslime
Copy link
Contributor

Implementation of a wrap function, mainly to avoid overflow.

@Peter0x44
Copy link
Contributor

To clarify, godot also provides such a function
https://docs.godotengine.org/en/stable/classes/[email protected]#class-gdscript-method-wrapf
so it's not entirely without precedent
still not sure this is something commonly used or worth it, but I can't see a reason not to include it either

@raysan5 raysan5 merged commit 81157e4 into raysan5:master Jun 14, 2022
@raysan5
Copy link
Owner

raysan5 commented Jun 14, 2022

@Tekkitslime Thanks for the addition!

raysan5 added a commit that referenced this pull request Jun 14, 2022
@quantumedbox
Copy link
Contributor

It's quite quite handy when you need to operate on wrapping subrange. For example, clock might be wrapped between -PI and PI to get rotation in closed range. Time in general follows such repeating systems often.

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

Successfully merging this pull request may close these issues.

4 participants