Created
February 23, 2016 03:41
-
-
Save anonymous/5611537fe1b1992add2b to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/rawilawuba
This file contains hidden or 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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width"> | |
| <title>JS Bin</title> | |
| </head> | |
| <body> | |
| <script id="jsbin-javascript"> | |
| var p1 = { | |
| x: 0, | |
| y: 0 | |
| }; | |
| var p2 = { | |
| x: 0, | |
| y: 45 | |
| }; | |
| // angle in degrees | |
| var angleDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI; | |
| console.log(angleDeg); | |
| </script> | |
| <script id="jsbin-source-javascript" type="text/javascript">var p1 = { | |
| x: 0, | |
| y: 0 | |
| }; | |
| var p2 = { | |
| x: 0, | |
| y: 45 | |
| }; | |
| // angle in degrees | |
| var angleDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI; | |
| console.log(angleDeg); | |
| </script></body> | |
| </html> |
This file contains hidden or 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
| var p1 = { | |
| x: 0, | |
| y: 0 | |
| }; | |
| var p2 = { | |
| x: 0, | |
| y: 45 | |
| }; | |
| // angle in degrees | |
| var angleDeg = Math.atan2(p2.y - p1.y, p2.x - p1.x) * 180 / Math.PI; | |
| console.log(angleDeg); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment