Instance Method

invert()

Inverts the transformation matrix if possible.

Declaration

mutating func invert()

Discussion

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 transform 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.

D = (m11 * m22) - (m12 * m21)

D < ε the inverse is undefined and will be nil

See Also

Accumulating Tranformations

func rotate(byDegrees: CGFloat)

Mutates an affine transformation matrix from a rotation value (angle α in degrees).

func rotate(byRadians: CGFloat)

Mutates an affine transformation matrix from a rotation value (angle α in radians).

func scale(CGFloat)

Mutates an affine transformation matrix to perform the given scaling in both x and y dimensions.

func scale(x: CGFloat, y: CGFloat)

Mutates an affine transformation matrix to perform a scaling in each of the x and y dimensions.

func translate(x: CGFloat, y: CGFloat)

Mutates an affine transformation matrix to perform the given translation.

func append(AffineTransform)

Mutates an affine transformation by appending the specified matrix.

func prepend(AffineTransform)

Mutates an affine transformation by prepending the specified matrix.

func inverted() -> AffineTransform?

Returns an inverted version of the matrix if possible, or nil if not.