PointType
public protocol PointType : Equatable
A type that can be used with +(_:_:) and −(_:_:) in conjunction with an associated Vector type.
Note
UnlikeStrideable, PointTypes do not need to conform to Comparable, allowing conformance by two‐dimensional points, etc.
Conformance Requirements:
Equatablestatic func += (lhs: inout Self, rhs: Vector)static func − (lhs: Self, rhs: Self) -> Vector
-
+(_:_:)Default implementationReturns 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) -> SelfParameters
lhsThe starting point.
rhsThe vector to add.
-
The type to be used as a vector.
Declaration
Swift
associatedtype Vector : Negatable -
+=(_:_:)Default implementationMoves 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
lhsThe point to modify.
rhsThe vector to add.
-
−(_:_:)Default implementationReturns 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) -> VectorParameters
lhsThe endpoint.
rhsThe startpoint.
-
−=(_:_:)Default implementationMoves 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
lhsThe point to modify.
rhsThe vector to subtract.
View on GitHub
PointType Protocol Reference