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

Vector[2,3,4] divideScalar does not match documentation. #23429

Closed
kmaxaurora opened this issue Feb 4, 2022 · 4 comments · Fixed by #23437
Closed

Vector[2,3,4] divideScalar does not match documentation. #23429

kmaxaurora opened this issue Feb 4, 2022 · 4 comments · Fixed by #23437

Comments

@kmaxaurora
Copy link

Describe the bug

The documentation states that divideScalar will set the vector to zero if the input is zero, but actually it gets set to NaN. Is documentation wrong or the code? I'd be happy to submit a PR either way. Thanks!

To Reproduce

Steps to reproduce the behavior:

  1. Get three.js
  2. Run the code below.

Code

const centroid = new Vector3(0, 0, 0);
centroid.divideScalar(0);

Live example

Expected behavior

Either it does not generate NaN or the documentation is changed.

Platform:

  • Same on all platforms
  • Three.js version: [dev]
@kmaxaurora
Copy link
Author

@kmaxaurora
Copy link
Author

Related:
#11241
#9387

@WestLangley
Copy link
Collaborator

Also see the discussion in #11253

@Mugen87
Copy link
Collaborator

Mugen87 commented Feb 5, 2022

I suggest to remove Set[s]() vector to ( 0, 0, 0 ) if *s = 0*. from the docs.

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

Successfully merging a pull request may close this issue.

3 participants