-
Notifications
You must be signed in to change notification settings - Fork 88
feat: Add translateByVector2 method to Matrix4 #349
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
2192266
feat: Add translateByVector2 method to Matrix4
luanpotter 6017083
Fix formating
luanpotter 3c4c518
Generated 64 bit version
luanpotter 4c6199f
Add to changelog
luanpotter 7ff603c
Fix changelog
luanpotter 5610bb9
Update pubspec
luanpotter 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 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| ## 2.2.1-wip | ||
| ## 2.3.0-wip | ||
|
|
||
| - Add translateByVector2 method to Matrix4. | ||
| - Require `sdk: ^3.7.0`. | ||
|
|
||
| ## 2.2.0 | ||
|
|
||
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -431,19 +431,19 @@ void testMatrix4SelfMultiplyTranspose() { | |
| void testMatrix4Translation() { | ||
| final inputA = <Matrix4>[]; | ||
| final inputB = <Matrix4>[]; | ||
| final output1 = <Matrix4>[]; | ||
| final output2 = <Matrix4>[]; | ||
| final outputA = <Matrix4>[]; | ||
| final outputB = <Matrix4>[]; | ||
|
|
||
| inputA.add(Matrix4.identity()); | ||
| inputB.add(Matrix4.translationValues(1.0, 3.0, 5.7)); | ||
| output1.add(inputA[0] * inputB[0] as Matrix4); | ||
| output2.add((Matrix4.identity())..translate(1.0, 3.0, 5.7)); | ||
| outputA.add(inputA[0] * inputB[0] as Matrix4); | ||
| outputB.add((Matrix4.identity())..translate(1.0, 3.0, 5.7)); | ||
|
|
||
| assert(inputA.length == inputB.length); | ||
| assert(output1.length == output2.length); | ||
| assert(outputA.length == outputB.length); | ||
|
|
||
| for (var i = 0; i < inputA.length; i++) { | ||
| relativeTest(output1[i], output2[i]); | ||
| relativeTest(outputA[i], outputB[i]); | ||
| } | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. note: I shifted the variable names a bit here to make it match some sort of logic with the new names, but please lmk if there is a preferred naming convention. tbh this test feels like two tests in one but I don't want to change the structure too much. |
||
|
|
||
| final input = Matrix4.fromList([ | ||
|
|
@@ -452,6 +452,13 @@ void testMatrix4Translation() { | |
| 3, 7, 11, 15, // | ||
| 4, 8, 12, 16, // | ||
| ]); | ||
| final output2 = input.clone(); | ||
| output2[12] = input.dotRow(0, Vector4(4, 8, 0, 1)); | ||
| output2[13] = input.dotRow(1, Vector4(4, 8, 0, 1)); | ||
| output2[14] = input.dotRow(2, Vector4(4, 8, 0, 1)); | ||
| output2[15] = input.dotRow(3, Vector4(4, 8, 0, 1)); | ||
| relativeTest(input.clone()..translateByVector2(Vector2(4.0, 8.0)), output2); | ||
|
|
||
| final output3 = input.clone(); | ||
| output3[12] = input.dotRow(0, Vector4(4, 8, 12, 1)); | ||
| output3[13] = input.dotRow(1, Vector4(4, 8, 12, 1)); | ||
|
|
||
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.
Uh oh!
There was an error while loading. Please reload this page.