Swap rotation while swapping placement#97
Open
BensonLaur wants to merge 1 commit intoJack000:masterfrom
Open
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Here is the current
mutatefunction:SVGnest/svgnest.js
Lines 872 to 894 in 1248dc2
When
clone.placement[i]andclone.placement[i]are swapped to create an order mutation, I think maybe it is better to also swap theclone.rotation.For example, if there are two 2 parts called
AandB. To put A in the bin,Acan not be rotated by90degree whileBcan do this.This means, the value of
clone.rotation[j](B) can be90while the value ofclone.rotation[i](A) is0.In this case, if
clone.placement[i]andclone.placement[j]are swapped, andclone.rotation[i]orclone.rotation[j]happens not to be regenerated bythis.randomAngle(clone.placement[i])later, then it would produce an unexpected mutation result.Although this issue will not happen to small parts data input, I think this change make it more reasonable for big parts input.
Here is the SVG input example mutationExample.zip, if needed, it can be used for test.