SelfIntersectableRectangleType

public protocol SelfIntersectableRectangleType : RectangleType

Protocol for rectangle geometric types that can be combined as intersection and unions with other rectangles of the same type.

  • Returns whether a given rectangle rests completely inside the boundaries of this rectangle.

    Declaration

    Swift

    func contains(_ other: Self) -> Bool
  • Returns whether this rectangle intersects the given rectangle instance. This check is inclusive, so the edges of the bounding box are considered to intersect the other bounding box’s edges as well.

    Declaration

    Swift

    func intersects(_ other: Self) -> Bool
  • Returns a rectangle which is the minimum rectangle that can fit this rectangle and other.

    Declaration

    Swift

    func union(_ other: Self) -> Self
  • Creates a rectangle which is equal to the positive area shared between this rectangle and other.

    If the rectangles do not intersect (i.e. produce a rectangle with < 0 bounds), nil is returned, instead.

    Declaration

    Swift

    func intersection(_ other: Self) -> Self?