Created
October 16, 2015 10:07
-
-
Save ashiato45/70cd212074c55cbf06a1 to your computer and use it in GitHub Desktop.
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
import Foundation | |
struct Point { | |
var x : Double; | |
var y : Double; | |
init(let inx : Double, let iny: Double){ | |
x = inx; | |
y = iny; | |
} | |
}; | |
let pointA : Point = Point(inx: 2,iny: 2) | |
let pointB : Point = Point(inx: -2,iny: 0) | |
let pointTemp = Point(PointA.x*PointB.x + PointA.y*PointB.y, -PointA.y*PointB.x + PointA.x*PointB.y) | |
let degree = atan2(pointTemp.x, pointTemp.y); | |
degree / M_PI * 180 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment