Skip to content

Instantly share code, notes, and snippets.

@ochanje210
Created March 2, 2017 05:40
Show Gist options
  • Select an option

  • Save ochanje210/fd424a3cf21777f7d32e30be069b2469 to your computer and use it in GitHub Desktop.

Select an option

Save ochanje210/fd424a3cf21777f7d32e30be069b2469 to your computer and use it in GitHub Desktop.
rotateXZ(dx, dy) {
const radX = (Math.PI / 180) * dx;
const cosX = Math.cos(radX);
const sinX = Math.sin(radX);
const radY = (Math.PI / 180) * dy;
const cosY= Math.cos(radY);
const sinY = Math.sin(radY);
return [
cosX, -cosY * sinX, sinX * sinY, 0,
sinX, cosX * cosY, -sinY * cosX, 0,
0, sinY, cosY, 0,
0, 0, 0, 1
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment