Point

public struct Point : Hashable

A structure that contains a point in a two-dimensional coordinate system.

  • The point with location (0, 0).

    Declaration

    Swift

    public static let zero: Point
  • x

    The x-coordinate of the point.

    Declaration

    Swift

    public var x: Float
  • y

    The y-coordinate of the point.

    Declaration

    Swift

    public var y: Float
  • Creates a point with coordinates specified as floating-point values.

    Declaration

    Swift

    @inlinable
    public init(x: Float, y: Float)

    Parameters

    x

    The x-coordinate of the point.

    y

    The y-coordinate of the point.

  • Creates a point with coordinates specified as integer values.

    Declaration

    Swift

    @inlinable
    public init(x: Int, y: Int)

    Parameters

    x

    The x-coordinate of the point.

    y

    The y-coordinate of the point.

  • Translates the lhs point by the specified rhs vector.

    Declaration

    Swift

    @inlinable
    public static func + (lhs: Point, rhs: Vector) -> Point

    Parameters

    lhs

    The point to translate.

    rhs

    The difference vector.

    Return Value

    The point created by translation the lhs point by the rhs vector.

  • Translates the lhs point by negation of the specified rhs vector.

    Declaration

    Swift

    @inlinable
    public static func - (lhs: Point, rhs: Vector) -> Point

    Parameters

    lhs

    The point to translate.

    rhs

    The difference vector.

    Return Value

    The point created by translation the lhs point by negation of the rhs vector.

  • Returns the vector that needs to be added to rhs to get lhs.

    Declaration

    Swift

    @inlinable
    public static func - (lhs: Point, rhs: Point) -> Vector

    Parameters

    lhs

    The first point.

    rhs

    The second point.

    Return Value

    The vector that needs to be added to rhs to get lhs.

  • Returns the point resulting from an affine transformation of an existing point.

    Declaration

    Swift

    @inlinable
    public func applying(_ transform: AffineTransform) -> Point

    Parameters

    transform

    The affine transform to apply.

    Return Value

    A new point resulting from applying the specified affine transform to the existing point.

  • Declaration

    Swift

    public var debugDescription: String { get }