-
-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Replace hypot()
in calculation.js with Math.hypot()
#6536
Comments
Hey @GregStanton I would like to work on this issue. |
That's great @Garima3110! Thank you! |
Hey @GregStanton |
Thanks @diyaayay for the PR. Just want to note that @Garima3110 had indicated intention to fix this first and my preference is to allow people to take their time working on an issue without needing to worry about getting it done quickly. In the future I would prefer prioritizing those who has indicated intention to work on an issue and defer until the original contributor indicated they are no longer willing to work on it or if sufficient time has passed (at least one month). Thanks! |
Hey @limzykenneth , Thankyou for letting me know. This was my first time at open source contributions. Will surely keep the code of conduct from now onwards. Thanks! |
Thanks @limzykenneth ! |
Increasing Access
Currently, calculation.js contains about 40 lines of code that are no longer necessary due to browser updates. Removing unnecessary complexity makes it easier for contributors to work with the codebase.
Most appropriate sub-area of p5.js?
Feature enhancement details
Problem:
The
hypot()
function was added to calculation.js in 2016. Its job is to call the nativeMath.hypot()
if it's supported and to provide a fallback function if not. At the time,Math.hypot()
was relatively new, but it's now been widely supported for close to a decade and is already used directly in 3d_primitives.js, interaction.js, and p5.Camera.js. Thehypot()
code now adds unnecessary complexity and performs an unnecessary check every timedist()
ormag()
is called (these functions callhypot()
internally).Solution:
Remove
hypot()
from calculation.js and replace calls to it (from the definitions ofdist()
) andmag()
) with calls toMath.hypot()
.The text was updated successfully, but these errors were encountered: