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
let angleToCenter: CGFloat = .pi / 5 | |
let angleToGridPoint: CGFloat = .pi / 3 | |
// 1.0471975511966 | |
let allowedRange = (angleToCenter - .pi / 8)...(angleToCenter + .pi / 8) | |
let angle = angleToGridPoint.clamped(to: allowedRange) | |
// 1.02101761241668 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment