Created
May 29, 2017 17:37
-
-
Save fabiomsr/9ce6a16f1874c514a9b215f4832f5a59 to your computer and use it in GitHub Desktop.
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
void preTranslate(Matrix4 leftMatrix, double x, double y) { | |
if(x == 0 && y == 0) { | |
return; | |
} | |
for (int i = 0; i < 4; ++i) { | |
var value = leftMatrix.entry(0, i) * x + leftMatrix.entry(1, i) * y; | |
value += leftMatrix.entry(2, i) + leftMatrix.entry(3, i); | |
leftMatrix.setEntry( 3, i, value); | |
} | |
} | |
void preScale(Matrix4 leftMatrix, double x, double y) { | |
if(x == 1 && y == 1) { | |
return; | |
} | |
for (int i = 0; i < 4; i++) { | |
leftMatrix.setEntry( 0, i, leftMatrix.entry(0, i) * x); | |
leftMatrix.setEntry( 1, i, leftMatrix.entry(1, i) * y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment