CGPoint
public extension CGPoint
-
Rotate this point around a given point, by an angle given in degrees.
Declaration
Swift
func rotated(around inCenter: CGPoint, byDegrees inDegrees: CGFloat, precisionInDecimalPlaces inPrecision: UInt8? = nil) -> CGPointParameters
inCenterAnother point, that is the “fulcrum” of the rotation.
inDegreesThe rotation angle, in degrees. 0 is no change. - is counter-clockwise, + is clockwise.
inPrecisionThe precision, in decimal places to the right of the decimal. This is optional, and, if omitted, uses full precision.
Return Value
The transformed point.
-
This was inspired by this SO answer. Rotate this point around a given point, by an angle given in radians.
Declaration
Swift
func rotated(around inCenter: CGPoint, byRadians inRadians: CGFloat, precisionInDecimalPlaces inPrecision: UInt8? = nil) -> CGPointParameters
inCenterAnother point, that is the “fulcrum” of the rotation.
inRadiansThe rotation angle, in radians. 0 is no change. - is counter-clockwise, + is clockwise.
inPrecisionThe precision, in decimal places to the right of the decimal. This is optional, and, if omitted, uses full precision. The range is 0…14.
Return Value
The transformed point.
View on GitHub