Matrix

public struct Matrix

Represents a matrix.

  • Initializes a new instance of the Matrix structure.

    Declaration

    Swift

    public init()

    Return Value

    The newly created Matrix object.

  • Translates the elements of this Matrix with the specified x and y coefficients.

    Declaration

    Swift

    public mutating func translate(_ dx: Double, dy: Double)

    Parameters

    dx

    The X-coefficient of the translation.

    dy

    The Y-coefficient of the translation.

  • Scales the elements of this Matrix with the specified x and y coefficients.

    Declaration

    Swift

    public mutating func scale(_ sx: Double, sy: Double)

    Parameters

    sx

    The X-coefficient of the scale.

    sy

    The Y-coefficient of the scale.

  • Undocumented

    Declaration

    Swift

    public mutating func scaleAtCenter(_ sx: Double, sy: Double, rect: Rect)
  • Rotates the elements of this Matrix at the specified angle around the specified pivot.

    Declaration

    Swift

    public mutating func rotateAt(_ angle: Double, pivotX: Double, pivotY: Double)

    Parameters

    angle

    The angle of rotation.

    pivotX

    The X-coordinate of the pivot point.

    pivotY

    The Y-coordinate of the pivot point.

  • Rotates the elements of this Matrix at the specified angle around the specified pivot point.

    Declaration

    Swift

    public mutating func rotateAt(_ angle: Double, pivot: Point)

    Parameters

    angle

    The angle of rotation.

    pivot

    The pivot point.

  • Rotates the elements of this Matrix at the specified angle.

    Declaration

    Swift

    public mutating func rotateAt(_ angle: Double)

    Parameters

    angle

    The angle of rotation.

  • Transforms the elements of this Matrix with the specified Point.

    Declaration

    Swift

    public func transform(_ point: Point) -> Point

    Parameters

    point

    The Point used by the transform.

    Return Value

    The transformed point.

  • Transforms the elements of this Matrix with the specified array of points and assigns the transformed values to them.

    Declaration

    Swift

    public func transform(_ points: inout [Point])

    Parameters

    points

    The points used by the transform.

  • Transforms the specified rectangle by this Matrix.

    Declaration

    Swift

    public func transform(_ rect: Rect) -> Rect

    Parameters

    rect

    The rectangle to transform.

    Return Value

    The transformed rectangle.

  • Maps the coordinate system of the source rectangle to that of the destination rectangle.

    Declaration

    Swift

    public static func mapCoordinateSystem(_ sourceRect: Rect, targetRect: Rect) -> Matrix

    Parameters

    sourceRect

    The source rectangle.

    targetRect

    The target rectangle.

    Return Value

    The transformation Matrix.

  • Undocumented

    Declaration

    Swift

    public static func multiply(_ m1: Matrix, _ m2: Matrix) -> Matrix
  • The elements of the Matrix.

    Declaration

    Swift

    public var elements: [Double]