Created
May 25, 2017 21:30
-
-
Save sikanrong/f84c3c2b7f3107026d8cf41d6f0bc4f5 to your computer and use it in GitHub Desktop.
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 untranslate = function(){ | |
| var angle = Math.atan(slope); | |
| var x1 = point.x - center.x; | |
| var y1 = point.y - center.y; | |
| var x2 = x1 * Math.cos(angle) - y1 * Math.sin(angle)); | |
| var y2 = x1 * Math.sin(angle) + y1 * Math.cos(angle)); | |
| var translated = {}; | |
| translated.x = x2 + center.x; | |
| translated.y = y2 + center.y; | |
| return translated; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment