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

Fix rounding of values close to 0 when computing smooth normals #6591

Merged
merged 1 commit into from
Nov 26, 2023

Conversation

davepagurek
Copy link
Contributor

Resolves #6590

Changes

I've updated the function to compute if vertices are the same to use rounding rather than toFixed.

Let's say you have two vertices, one at x=-1e-8 and one at x=1e-8. Previouisly, using toFixed, these values become -0.000 and 0.000, which are different strings, so they don't end up equal. After this change, both end up 0.

Screenshots of the change

Updated version of the sketch in the issue:
https://editor.p5js.org/davepagurek/sketches/WJ4DtuCcV

image

PR Checklist

  • npm run lint passes
  • [Inline documentation] is included / updated
  • [Unit tests] are included / updated

@davepagurek
Copy link
Contributor Author

@capGoblin does this look good to you?

@davepagurek davepagurek mentioned this pull request Nov 25, 2023
7 tasks
@capGoblin
Copy link
Contributor

alright, makes sense, Let's merge it!

@davepagurek davepagurek merged commit 7587e0a into processing:main Nov 26, 2023
2 checks passed
@davepagurek davepagurek deleted the fix/smooth-normals-seams branch November 26, 2023 13:14
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

Successfully merging this pull request may close these issues.

computeNormals(SMOOTH) causes seams around values close to 0
2 participants