Vector lerp() function now takes in generalized dimensions#8994
Open
mawerb wants to merge 8 commits into
Open
Conversation
Continuous ReleaseCDN linkPublished PackagesCommit hash: a53af53 Previous deploymentsThis is an automated message. |
Comment on lines
+58
to
+64
| if (!this.friendlyErrorsDisabled()) { | ||
| this._friendlyError( | ||
| 'Requires valid arguments', | ||
| 'p5.Vector' | ||
| ); | ||
| } | ||
| return this; |
Collaborator
There was a problem hiding this comment.
I think this code is repeated six times in this function. Can we create a helper function that takes the message as an argument? Then we can replace these repeated lines with a single helper call. That way we can reduce the code?
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.
Resolves #8927
Changes:
lerp()to take in generalized dimensions allowing for function to be called on vectors with more than 3 dimensions and mismatched._validatedVectorOperationdecorator to be able to take in trailingArgs in order to fit the case oflerp()where it follows the pattern of validating parameters its taking with ...args like themult(),add(),sub()functions but requiring the extra argumentamtlerp()works as intended on mismatched dimensions and vectors with dimensions > 3Screenshots of the change:

the 1 failed test was present before changes were made (it's the typography test)
PR Checklist
npm run lintpasses