Skip to content

Instantly share code, notes, and snippets.

@jczimm
Created May 13, 2014 18:08
Show Gist options
  • Save jczimm/943d961fee0436167773 to your computer and use it in GitHub Desktop.
Save jczimm/943d961fee0436167773 to your computer and use it in GitHub Desktop.
function rotate_point(pointX, pointY, originX, originY, angle) {
angle = angle * Math.PI / 180.0;
return [
Math.cos(angle) * (pointX-originX) - Math.sin(angle) * (pointY-originY) + originX,
Math.sin(angle) * (pointX-originX) + Math.cos(angle) * (pointY-originY) + originY
];
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment