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

Normalize should not check for arbitrarily small lengths #38

Open
deluksic opened this issue Jan 12, 2025 · 0 comments
Open

Normalize should not check for arbitrarily small lengths #38

deluksic opened this issue Jan 12, 2025 · 0 comments

Comments

@deluksic
Copy link

I discovered a bug in my app because vec2.normalize was avoiding division by 0 by checking an arbitrarily small length:

https://github.com/greggman/wgpu-matrix/blob/main/src/vec2-impl.ts#L506

I believe it should only check for 0, by doing len || 1 for example and leave other numerical instabilities to the caller.

Situation in which this appeared is a demo app where you can zoom in a lot, so vectors become super small. That doesn't mean that these are not valid vector values that can be normalized.

(demo app in question https://deluksic.github.io/apollonian-circles/)

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