Last active
September 23, 2023 10:47
-
-
Save RezaAmd/f0299e9f59c1906819570170d4da99f0 to your computer and use it in GitHub Desktop.
Calculate two points angle degree in 2D graph
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// JavaScript: | |
const angleCalculator = function(ax, ay, bx, by) | |
{ | |
return Math.atan2(by - ay, bx - ax) * 180 / Math.PI | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
For example :
A[1x , 1y] - B[2x , 2y]
A[-1x , -2y] - B[3x , 0y]
A[1x , -3y] - B[1x , 2y]