Point
public struct Point : Hashable
Represents a geometrical point. Implements the Hashable protocol.
-
Initializes a new point with zero coordinates.
Declaration
Swift
public init()Return Value
The newly created point.
-
Initializes a new point with the specified coordinates.
Declaration
Swift
public init(x: Double, y: Double)Parameters
xThe x-coordinate of the new point.
yThe y-coordinate of the new point.
Return Value
The newly created point.
-
Initializes a new point from the specified point.
Declaration
Swift
public init(p: Point)Parameters
pThe point whose coordinates are set to the new point.
Return Value
The newly created point.
-
Initializes a new point from the specified CGPoint point.
Declaration
Swift
public init(p: CGPoint)Parameters
pThe CGPoint point whose coordinates are set to the new point.
Return Value
The newly created point.
-
Calculates the distance between this point and the specified point.
Declaration
Swift
public func distance(_ p: Point) -> DoubleParameters
pThe point to which the distance is measured.
Return Value
The distance.
-
Calculates the squared distance between this point and the specified point.
Declaration
Swift
public func distanceSquared(_ p: Point) -> DoubleParameters
pThe point to which the distance is measured.
Return Value
The squared distance.
-
Calculates the point at the middle of the line between this point and the specified point.
Declaration
Swift
public func middle(_ p: Point) -> PointParameters
pThe end point of the line at which the middle point is calculated.
Return Value
The middle point.
-
Calculates if the coordinates of this point and the specified point equal epsilon.
Declaration
Swift
public func equalEpsilon(_ p: Point) -> BoolParameters
pThe other point whose coordinates are taken by the comparison.
Return Value
true if the x-coordinates of the both points and the y-coordinates of both points equal epsilon.
-
Parses the x and y coordinates of a point from strings.
Declaration
Swift
public static func fromString(_ s: String) -> PointParameters
sThe string to parse.
Return Value
A point with coordinates parsed from the string.
-
Specifies an empty point.
Declaration
Swift
public static let empty: Point -
Specifies the X-coordinate of the Point.
Declaration
Swift
public var x: Double -
Specifies the Y-coordinate of the Point.
Declaration
Swift
public var y: Double
Point Structure Reference