Skip to content

Instantly share code, notes, and snippets.

@ochanje210
Created March 2, 2017 04:38
Show Gist options
  • Save ochanje210/14fe4c19ff141409262678744ea52c1f to your computer and use it in GitHub Desktop.
Save ochanje210/14fe4c19ff141409262678744ea52c1f to your computer and use it in GitHub Desktop.
rotateXY(dx, dy) {
const radX = (Math.PI / 180) * dy;
const cosX = Math.cos(radX);
const sinX = Math.sin(radX);
const radY = (Math.PI / 180) * -dx;
const cosY= Math.cos(radY);
const sinY = Math.sin(radY);
return [
cosY, sinX * sinY, cosX * sinY, 0,
0, cosX, -sinX, 0,
-sinY, cosY * sinX, cosX * cosY, 0,
0, 0, 0, 1
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment