Skip adding degenerate faces in textToModel #7951
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Addresses one case of #4791
While this warning generally indicates a problem with the user's vertex input, we also get this warning sometimes when calling
font.textToModel()
. In this case, there's nothing the user can do about it, so the warning is distracting and misleading. While this doesn't fully deal with that warning happening more often than it should, this resolves thetextToModel
case.(EDIT: maybe this actually does fully resolve the original issue? Looking back at it, the original sketch in question was also triangulating a font. Now that we have a way to do this internally that doesn't create warnings, the rest is likely user input issues.)
Changes:
_validateFaces
flag which, when set to true, checks if faces are valid before adding them to a p5.GeometrycomputeNormals
otherwise.Before:

After:

Live: https://editor.p5js.org/davepagurek/sketches/zOmI5K3__ (try toggling the script tag to 2.0.3 in index.html)
PR Checklist
npm run lint
passes