Rectangle

public struct Rectangle : Equatable, Hashable

Rectangle area defined by origin point and size.

  • Undocumented

    Declaration

    Swift

    public init(origin: Point = Point(), size: Size = Size())
  • Undocumented

    Declaration

    Swift

    public init(x: Double, y: Double, width: Double, height: Double)
  • Undocumented

    Declaration

    Swift

    public init(left: Double, top: Double, right: Double, bottom: Double)
  • Undocumented

    Declaration

    Swift

    public var origin: Point
  • Undocumented

    Declaration

    Swift

    public var size: Size
  • Undocumented

    Declaration

    Swift

    public var topLeft: Point { get }
  • Undocumented

    Declaration

    Swift

    public var topRight: Point { get }
  • Undocumented

    Declaration

    Swift

    public var bottomLeft: Point { get }
  • Undocumented

    Declaration

    Swift

    public var bottomRight: Point { get }
  • Undocumented

    Declaration

    Swift

    public var left: Double { get }
  • Undocumented

    Declaration

    Swift

    public var right: Double { get }
  • top

    Undocumented

    Declaration

    Swift

    public var top: Double { get }
  • Undocumented

    Declaration

    Swift

    public var bottom: Double { get }
  • Undocumented

    Declaration

    Swift

    public var width: Double { get }
  • Undocumented

    Declaration

    Swift

    public var height: Double { get }
  • Undocumented

    Declaration

    Swift

    public var centerX: Double { get }
  • Undocumented

    Declaration

    Swift

    public var centerY: Double { get }
  • Undocumented

    Declaration

    Swift

    public var centerLeft: Point { get }
  • Undocumented

    Declaration

    Swift

    public var centerRight: Point { get }
  • Undocumented

    Declaration

    Swift

    public var topCenter: Point { get }
  • Undocumented

    Declaration

    Swift

    public var bottomCenter: Point { get }
  • Undocumented

    Declaration

    Swift

    public var center: Point { get }
  • Returns a segment representing a side border for the rectangle.

    Declaration

    Swift

    public func borderLine(position: BorderPosition) -> Line
  • Returns a rectangle obtained by translation, preserving original size.

    Declaration

    Swift

    public func movedBy(dx: Double = 0, dy: Double = 0) -> Rectangle
  • Returns a rectangle obtained by decreasing size, preserving original center.

    Declaration

    Swift

    public func insetBy(dx: Double = 0, dy: Double = 0) -> Rectangle
  • Returns a rectangle obtained by decreasing size by the same amount horizontally and vertically, preserving original center.

    Declaration

    Swift

    public func insetBy(_ value: Double) -> Rectangle
  • Returns a rectangle obtained by translation and decreasing size, according to the specified side border translations.

    Declaration

    Swift

    public func insetBy(dxLeft: Double = 0, dxRight: Double = 0,
                        dyTop: Double = 0, dyBottom: Double = 0) -> Rectangle
  • Determines whether the rectangle contains a specific point. Rectangle limits (top-left and bottom-right) are considered to be included.

    Declaration

    Swift

    public func contains(_ point: Point) -> Bool
  • Determines whether the rectangle intersects another rectangle. Touching rectangle limits are considered to generate intersection as well.

    Declaration

    Swift

    public func intersects(_ rectangle: Rectangle) -> Bool
  • Determines whether the rectangle intersects a line segment. Touching rectangle limits are considered to generate intersection as well.

    Declaration

    Swift

    public func intersects(_ line: Line) -> Bool
  • Returns the intersection with another rectangle. Touching rectangle limits are considered to generate (zero-sized) intersection as well. Returns nil when rectangle don’t intersect.

    Declaration

    Swift

    public func intersecting(_ rectangle: Rectangle) -> Rectangle?
  • Undocumented

    Declaration

    Swift

    init(_ source: CGRect)
  • Undocumented

    Declaration

    Swift

    init?(_ source: CGRect?)