Skip to content

Instantly share code, notes, and snippets.

@ashiato45
Created October 16, 2015 10:07
Show Gist options
  • Save ashiato45/70cd212074c55cbf06a1 to your computer and use it in GitHub Desktop.
Save ashiato45/70cd212074c55cbf06a1 to your computer and use it in GitHub Desktop.
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