Skip to content

Instantly share code, notes, and snippets.

@XavierTalpe
Created November 5, 2012 21:22
Show Gist options
  • Select an option

  • Save XavierTalpe/4020404 to your computer and use it in GitHub Desktop.

Select an option

Save XavierTalpe/4020404 to your computer and use it in GitHub Desktop.
2D rotation around a point
double cosAlpha = Math.cos( angle );
double sinAlpha = Math.sin( angle );
double dX = x - originX;
double dY = y - originY;
double x = originX + cosAlpha * dX - sinAlpha * dY;
double y = originY + sinAlpha * dX + cosAlpha * dY;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment