AABB2

extension AABB2: CustomStringConvertible
public extension AABB2 where Vector: VectorComparable
public extension AABB2 where Vector: VectorAdditive
extension AABB2: Convex2Type where Vector: Vector2FloatingPoint
  • Declaration

    Swift

    public var description: String { get }
  • x

    The x coordinate of the left corner of this 2d box.

    Alias for minimum.x.

    Declaration

    Swift

    var x: Scalar { get }
  • y

    The y coordinate of the top corner of this 2d box.

    Alias for minimum.y.

    Declaration

    Swift

    var y: Scalar { get }
  • The x coordinate of the left corner of this 2d box.

    Alias for minimum.x.

    Declaration

    Swift

    var left: Scalar { get }
  • top

    The y coordinate of the top corner of this 2d box.

    Alias for minimum.y.

    Declaration

    Swift

    var top: Scalar { get }
  • The x coordinate of the right corner of this 2d box.

    Alias for maximum.x.

    Declaration

    Swift

    var right: Scalar { get }
  • The y coordinate of the bottom corner of this 2d box.

    Alias for maximum.y.

    Declaration

    Swift

    var bottom: Scalar { get }
  • The top-left corner of the 2d box.

    Declaration

    Swift

    var topLeft: Vector { get }
  • The top-right corner of the 2d box.

    Declaration

    Swift

    var topRight: Vector { get }
  • The bottom-right corner of the 2d box.

    Declaration

    Swift

    var bottomRight: Vector { get }
  • The bottom-left corner of the 2d box.

    Declaration

    Swift

    var bottomLeft: Vector { get }
  • Returns an array of vectors that represent this AABB‘s 2D corners in clockwise order, starting from the top-left corner.

    Always contains 4 elements.

    Declaration

    Swift

    @inlinable
    var corners: [Vector] { get }
  • Initializes a AABB with the edges of a box.

    Declaration

    Swift

    init(left: Scalar, top: Scalar, right: Scalar, bottom: Scalar)

Available where Vector: VectorComparable

  • Returns whether a given point is contained within this 2d box.

    The check is inclusive, so the edges of the box are considered to contain the point as well.

    Declaration

    Swift

    func contains(x: Scalar, y: Scalar) -> Bool

Available where Vector: VectorAdditive

  • Initializes a AABB with the coordinates of a rectangle.

    Declaration

    Swift

    @inlinable
    init(x: Scalar, y: Scalar, width: Scalar, height: Scalar)