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

feature request: isZeroLength for Vector #203

Open
ensconced opened this issue Nov 19, 2024 · 1 comment
Open

feature request: isZeroLength for Vector #203

ensconced opened this issue Nov 19, 2024 · 1 comment

Comments

@ensconced
Copy link

Segment has an isZeroLength method - would it make sense to add the same for Vector?

Of couse I can do vec.length === 0, but this involves an expensive Math.sqrt.
I can do vec.dot(vec) === 0 to avoid the sqrt, but this somewhat less readable.

@ensconced
Copy link
Author

Alternatively, maybe we could have a lengthSquared method - that would also serve cases where vectors need to be compared by length, and the overhead of the sqrt is not necessary

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

No branches or pull requests

1 participant