Last active
November 14, 2015 09:48
-
-
Save odrobnik/f1eef9c02488be0e9827 to your computer and use it in GitHub Desktop.
Smallest Turning Angle in Radians - CW rotations position, CCW rotations negative
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
import Darwin | |
let π = CGFloat(M_PI) | |
let _2π = CGFloat(2.0 * π) | |
extension CGFloat | |
{ | |
func angleDeltaForShortestRotation(#toAngle: CGFloat) -> CGFloat | |
{ | |
return remainder(toAngle - self + _2π, _2π) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment