Created
January 13, 2016 13:52
-
-
Save FlexMonkey/3b500550fe51fa659d88 to your computer and use it in GitHub Desktop.
distanceTo() - extension to CGPoint returns distance between two points
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
extension CGPoint | |
{ | |
func distanceTo(point: CGPoint) -> CGFloat | |
{ | |
return hypot(self.x - point.x, self.y - point.y) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment