Do away with strokeIndices and construct Geometry directly with edges #6121
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.
Currently, strokeIndices is used to define edges regardless of faces when composing geometry.
However, the way to configure edges using it is to copy the contents of strokeIndices to edges as they are in _makeTriangleEdges(), which is a wasteful process.
So, I wanted to rewrite the processing method so that edge information is stored in edges from the beginning.
StrokeIndices is not prepared even at initialization, and in that sense it is not a very natural process.
Also, when creating APIs in the future, I thought it would cause confusion if there was a way of processing that didn't matter which way, so I wanted to unify it.
In addition to that, the specification of model() was changed so that edges are constructed from faces only when edges are not provided in the model function. This allows p5.Geometry to construct a geometry without losing its contents for edges, even if it has no faces and only edges, or constructs its own edges.
Resolves #6120
Changes:
Screenshots of the change:
Demo: patch_model_2
I tried it, but the box, triangle, arc, and rect whose specifications were changed here were all drawn as usual.
PR Checklist
npm run lint
passes