Skip to content

Instantly share code, notes, and snippets.

@neysidev
Created December 5, 2023 10:48
Show Gist options
  • Select an option

  • Save neysidev/61d4e52ca9c52734f57d5d7dae242a1a to your computer and use it in GitHub Desktop.

Select an option

Save neysidev/61d4e52ca9c52734f57d5d7dae242a1a to your computer and use it in GitHub Desktop.
function calculateAngle(point1, point2) {
const angleInRadians = Math.atan2(point2.y - point1.y, point2.x - point1.x);
const angleInDegrees = (angleInRadians * 180) / Math.PI;
return angleInDegrees;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment