Rectangle

public struct Rectangle<N> : Equatable, CustomStringConvertible where N : Numeric

A generic type that captrues a rectangular region in 2D space with an origin and size

  • The origin of the rectangle

    Declaration

    Swift

    public var origin: Point<N>
  • The size of the rectangle

    Declaration

    Swift

    public var size: Dimension<N>
  • Creates a new instance with individual parameters for the origin and size

    Declaration

    Swift

    public init(x: N, y: N, width: N, height: N)

    Parameters

    x

    The origin x coordinate

    y

    The origin y coordinate

    width

    The width of the rectangle

    height

    The height of the rectangle

  • Creates a new instance with the supplied origin and size

    Declaration

    Swift

    public init(origin: Point<N>, size: Dimension<N>)

    Parameters

    origin

    The origin of the rectangle

    size

    The size of the rectangle

  • The description of the rectangle

    Declaration

    Swift

    public var description: String { get }