init(rotationByDegrees:)
Creates an affine transformation matrix from a rotation value (angle in degrees). The matrix takes the following form:
init(rotationByDegrees angle: CGFloat)
[ cos α sin α 0 ]
[ -sin α cos α 0 ]
[ 0 0 1 ]
Creates an affine transformation matrix from a rotation value (angle in degrees). The matrix takes the following form:
init(rotationByDegrees angle: CGFloat)
s10Foundation15AffineTransformV17rotationByDegreesAcA7CGFloatV_tcfc
What are these?8T8EK
[ cos α sin α 0 ]
[ -sin α cos α 0 ]
[ 0 0 1 ]
import Foundation
struct AffineTransform
AffineTransform represents an affine transformation matrix of the following form:
@frozen struct CGFloat
init()
Creates an affine transformation matrix with identity values.
init(from decoder: any Decoder) throws
init(m11: CGFloat, m12: CGFloat, m21: CGFloat, m22: CGFloat, tX: CGFloat, tY: CGFloat)
Creates an affine transformation.
init(rotationByRadians angle: CGFloat)
Creates an affine transformation matrix from rotation value (angle in radians). The matrix takes the following form:
init(scale factor: CGFloat)
Creates an affine transformation matrix from scaling a single value. The matrix takes the following form:
init(scaleByX x: CGFloat, byY y: CGFloat)
Creates an affine transformation matrix from scaling values. The matrix takes the following form:
init(translationByX x: CGFloat, byY y: CGFloat)
Creates an affine transformation matrix from translation values. The matrix takes the following form:
static let identity: AffineTransform
An identity affine transformation matrix
var debugDescription: String { get }
A textual description of the transform suitable for debugging.
var description: String { get }
A textual description of the transform.
var m11: CGFloat
var m12: CGFloat
var m21: CGFloat
var m22: CGFloat
var tX: CGFloat
var tY: CGFloat
mutating func append(_ transform: AffineTransform)
Mutates an affine transformation by appending the specified matrix.
func encode(to encoder: any Encoder) throws
mutating func invert()
Inverts the transformation matrix if possible. Matrices with a determinant that is less than the smallest valid representation of a double value greater than zero are considered to be invalid for representing as an inverse. If the input AffineTransform can potentially fall into this case then the inverted() method is suggested to be used instead since that will return an optional value that will be nil in the case that the matrix cannot be inverted.
func inverted() -> AffineTransform?
Returns an inverted version of the matrix if possible, or nil if not.
mutating func prepend(_ transform: AffineTransform)
Mutates an affine transformation by prepending the specified matrix.
mutating func rotate(byDegrees angle: CGFloat)
Mutates an affine transformation matrix from a rotation value (angle α in degrees). The matrix takes the following form:
mutating func rotate(byRadians angle: CGFloat)
Mutates an affine transformation matrix from a rotation value (angle α in radians). The matrix takes the following form:
mutating func scale(_ scale: CGFloat)
Mutates an affine transformation matrix to perform the given scaling in both x and y dimensions.
mutating func scale(x: CGFloat, y: CGFloat)
Mutates an affine transformation matrix to perform a scaling in each of the x and y dimensions.
func transform(_ size: CGSize) -> CGSize
Applies the transform to the specified size and returns the result.
func transform(_ point: CGPoint) -> CGPoint
Applies the transform to the specified point and returns the result.
mutating func translate(x: CGFloat, y: CGFloat)
typealias ReferenceType = NSAffineTransform