Matrix
public struct Matrix
Matrix holds a 3x3 matrix for transforming coordinates. This allows mapping
Point and vectors with translation, scaling, skewing, rotation, and
perspective.
Matrix elements are in row major order. Matrix does not have a constructor,
so it must be explicitly initialized. setIdentity() initializes Matrix
so it has no effect. setTranslate(), setScale(), setew(), setRotate(), set9 and setAll()
initializes all Matrix elements with the corresponding mapping.
Matrix includes a hidden variable that classifies the type of matrix to
improve performance. Matrix is not thread safe unless getType() is called first.
You can either create the matrix by using one of the constuctors, or using some of the
convenience static methods that start with make
-
Undocumented
Declaration
Swift
public init(scaleX: Float = 0, skewX: Float = 0, transX: Float = 0, scaleY: Float = 0, skewY: Float = 0, transY: Float = 0, persp0: Float = 0, persp1: Float = 0, persp2: Float = 0) -
The identity matrix
Declaration
Swift
public static var identity: Matrix { get } -
Creates a translation matrix (dx, dy).
Declaration
Swift
public static func makeTranslation(sx: Float, sy: Float) -> MatrixParameters
dxhorizontal translation
dyvertical translation
Return Value
Matrixwith translation -
Creates a new scale matrix.
Declaration
Swift
public static func makeScale(sx: Float, sy: Float) -> MatrixParameters
sxThe scaling in the x direction
syThe scaling in the y direction
-
Undocumented
Declaration
Swift
public static func makeSkew(sx: Float, sy: Float) -> Matrix -
Undocumented
Declaration
Swift
public static func concat(target: inout Matrix, first: Matrix, second: Matrix) -
Undocumented
Declaration
Swift
public static func preConcat(target: inout Matrix, matrix: Matrix) -
Undocumented
Declaration
Swift
public static func postConcat(target: inout Matrix, matrix: Matrix)
View on GitHub
Install in Dash
Matrix Structure Reference