gh-EmergeTools-Pow/Sources/Pow/Extensions/CGPoint+Utilities.swift
Joe Fabisevich 5b95fe95b0
Moving Pow to @emergetools (#36)
Co-authored-by: Robert Böhnke <robb@robb.is>
Co-authored-by: Kasper Lahti <kasper@lahti.email>
2023-11-29 12:08:53 -03:00

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))
}
}