Skip to content

Instantly share code, notes, and snippets.

@RomainKurtz
Created August 8, 2016 20:16
Show Gist options
  • Save RomainKurtz/ed3f61331b37da28bcc32c5ca301f869 to your computer and use it in GitHub Desktop.
Save RomainKurtz/ed3f61331b37da28bcc32c5ca301f869 to your computer and use it in GitHub Desktop.
function rotatePoint(point, center, angle){
angle = (angle ) * (Math.PI/180); // Convert to radians
var rotatedX = Math.cos(angle) * (point.x - center.x) - Math.sin(angle) * (point.y-center.y) + center.x;
var rotatedY = Math.sin(angle) * (point.x - center.x) + Math.cos(angle) * (point.y - center.y) + center.y;
return new THREE.Vector2(rotatedX,rotatedY);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment