mirror of
https://github.com/EmergeTools/Pow.git
synced 2026-03-26 09:05:50 +00:00
Co-authored-by: Robert Böhnke <robb@robb.is> Co-authored-by: Kasper Lahti <kasper@lahti.email>
11 lines
278 B
Swift
11 lines
278 B
Swift
import SwiftUI
|
|
|
|
extension CGPoint {
|
|
func distance(to other: CGPoint) -> CGFloat {
|
|
sqrt((x - other.x) * (x - other.x) + (y - other.y) * (y - other.y))
|
|
}
|
|
|
|
func angle(to other: CGPoint) -> Angle {
|
|
Angle(radians: atan2(other.y - y, other.x - x))
|
|
}
|
|
}
|