Forked from jmurzy/foldview-transformUtil-transformOrigin.js
Created
December 1, 2020 03:21
-
-
Save ysfzrn/127ba892bfb6fbbfe4e97a674d86cfb3 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