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

Squared velocity lengths #1291

Merged
merged 2 commits into from Jan 16, 2017

Conversation

Projects
None yet
3 participants
@Luabee
Contributor

Luabee commented Dec 10, 2016

Computing the square root of a number is expensive. By switching to LengthSqr and Length2DSqr, we skip this square-rooting altogether.

This only works for comparisons like these, since for any two numbers x and y, where x < y, we can assume that x*x < y*y.

Squared velocity lengths
Computing the square root of a number is expensive. By switching to LengthSqr and Length2DSqr, we skip this square-rooting altogether. This only works for comparisons like these, since for any two numbers x and y, where x < y, we can assume that x*x < y*y.
@Kefta

This comment has been minimized.

Contributor

Kefta commented Dec 10, 2016

You can just change the mul operations into plain numbers -- looks cleaner that way imo

@robotboy655 robotboy655 merged commit 03b8217 into Facepunch:master Jan 16, 2017

@Luabee Luabee deleted the Luabee:patch-1 branch Feb 14, 2017

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