Last active
April 2, 2022 18:52
-
-
Save jmurzy/0d62c0b5ea88ca806c16b5e8a16deb6a 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
function transformOrigin(matrix, origin) { | |
const { x, y, z } = origin; | |
const translate = MatrixMath.createIdentityMatrix(); | |
MatrixMath.reuseTranslate3dCommand(translate, x, y, z); | |
MatrixMath.multiplyInto(matrix, translate, matrix); | |
const untranslate = MatrixMath.createIdentityMatrix(); | |
MatrixMath.reuseTranslate3dCommand(untranslate, -x, -y, -z); | |
MatrixMath.multiplyInto(matrix, matrix, untranslate); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment