-
Notifications
You must be signed in to change notification settings - Fork 41
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
Generate skirt vertices and triangles #12
Open
TimGurnett
wants to merge
3
commits into
mapbox:main
Choose a base branch
from
TimGurnett:master
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree in principle with reducing function bloat, and performance is very important to my use case too. I also believe it's beneficial to remove duplicate complex code and adding skits as an option to getMesh, if possible. Would you be open to combining the functions into one, together?
If you'd prefer to keep it this way, that is also fine. Are you looking for a 3rd party review? I can pull this down and test it out.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem lies in getMesh being so concise and elegant :)
When I started adding if (skirt) blocks to handle the custom code I felt like I was making a mess. Once I started changing the vertices and triangle arrays as well as the return object (and more than doubling the length of the original function) I figured it might be neater to separate - though harder to maintain because of the code duplication of the core logic. I also thought a new user would have less trouble understanding getMesh by itself than getMesh with the skirt flag. @mourner any preference?
I'm guessing that the performance loss of the if (skirt) statement inside the recursive countElements function would be negligible but would have to bench at scale to be sure.
p.s. I also don't know if the way I'm generating the skirts is sound or if there's shortcuts etc that might make all of this moot