PointType

public protocol PointType : Equatable

A type that can be used with +(_:_:) and −(_:_:) in conjunction with an associated Vector type.

Note

Unlike Strideable, PointTypes do not need to conform to Comparable, allowing conformance by two‐dimensional points, etc.

Conformance Requirements:

  • Equatable
  • static func += (lhs: inout Self, rhs: Vector)
  • static func − (lhs: Self, rhs: Self) -> Vector
  • +(_:_:) Default implementation

    Returns the point arrived at by starting at the point on the left and moving according to the vector on the right.

    Mutating variant

    +=

    Default Implementation

    Returns the point arrived at by starting at the point on the left and moving according to the vector on the right.

    Mutating variant

    +=

    Declaration

    Swift

    static func + (lhs: Self, rhs: Vector) -> Self

    Parameters

    lhs

    The starting point.

    rhs

    The vector to add.

  • The type to be used as a vector.

    Declaration

    Swift

    associatedtype Vector : Negatable
  • +=(_:_:) Default implementation

    Moves the point on the left by the vector on the right.

    Nonmutating variant

    +

    Default Implementation

    Moves the point on the left by the vector on the right.

    Nonmutating variant

    +

    Declaration

    Swift

    static func += (lhs: inout Self, rhs: Vector)

    Parameters

    lhs

    The point to modify.

    rhs

    The vector to add.

  • −(_:_:) Default implementation

    Returns the vector that leads from the point on the left to the point on the right.

    Default Implementation

    Returns the vector that leads from the point on the left to the point on the right.

    Declaration

    Swift

    static func  (lhs: Self, rhs: Self) -> Vector

    Parameters

    lhs

    The endpoint.

    rhs

    The startpoint.

  • −=(_:_:) Default implementation

    Moves the point on the left by the inverse of the vector on the right.

    Nonmutating variant

    Default Implementation

    Moves the point on the left by the inverse of the vector on the right.

    Nonmutating variant

    Declaration

    Swift

    static func = (lhs: inout Self, rhs: Vector)

    Parameters

    lhs

    The point to modify.

    rhs

    The vector to subtract.