Point2
public struct Point2 : Equatable, Hashable, Comparable
A point in 2 dimensional grid.
-
The x coordinate of the point.
Declaration
Swift
public var x: Int -
The y coordinate of the point.
Declaration
Swift
public var y: Int -
Creates a Point2 at the given location.
Declaration
Swift
public init(x: Int, y: Int) -
The Euclidean distance from the origin to
self.Declaration
Swift
public var magnitude: Double { get } -
The number of steps on the shortest path that excluding diagonals from the origin to
self.Declaration
Swift
public var manhattenDistance: Int { get } -
Adds
rhsintolhs.Declaration
Swift
public static func += (lhs: inout `Self`, rhs: `Self`) -
Returns a new coordinate that is the vector sum of
lhsandrhs.Declaration
Swift
public static func + (lhs: `Self`, rhs: `Self`) -> Point2 -
Arbitrary ordering of points.
Declaration
Swift
public static func < (lhs: `Self`, rhs: `Self`) -> Bool -
Returns a point that if added to
rhxwould yield the Point2(x: 0, y: 0).Declaration
Swift
public prefix static func - (rhs: `Self`) -> Point2 -
Undocumented
Declaration
Swift
public static func -= (lhs: inout `Self`, rhs: `Self`) -
Undocumented
Declaration
Swift
public static func - (lhs: `Self`, rhs: `Self`) -> Point2 -
The point corresponding to (0, 0).
Declaration
Swift
public static var origin: `Self` { get }
View on GitHub
Point2 Structure Reference