Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Box2

Represents an axis-aligned bounding box (AABB) in 2D space.

Hierarchy

  • Box2

Index

Constructors

constructor

  • Creates a Box2 bounded by min and max.

    Parameters

    • Optional min: I3JS.Vector2

      Vector2 representing the lower (x, y) boundary of the box. Default is ( + Infinity, + Infinity ).

    • Optional max: I3JS.Vector2

      Vector2 representing the upper (x, y) boundary of the box. Default is ( - Infinity, - Infinity ).

    Returns I3JS.Box2

Properties

max

Vector2 representing the lower upper (x, y) boundary of the box. Default is ( - Infinity, - Infinity ).

min

Vector2 representing the lower (x, y) boundary of the box. Default is ( + Infinity, + Infinity ).

Methods

clampPoint

clone

containsBox

containsPoint

  • Returns true if the specified point lies within or on the boundaries of this box.

    Parameters

    Returns boolean

    Returns true if the specified point lies within or on the boundaries of this box.

copy

distanceToPoint

equals

expandByPoint

expandByScalar

  • expandByScalar(scalar: number): I3JS.Box2

expandByVector

getCenter

getParameter

getSize

intersect

  • Parameters

    Returns I3JS.Box2

    Returns the intersection of this and box, setting the upper bound of this box to the lesser of the two boxes' upper bounds and the lower bound of this box to the greater of the two boxes' lower bounds.

intersectsBox

isEmpty

  • isEmpty(): boolean
  • Returns boolean

    Returns true if this box includes zero points within its bounds. Note that a box with equal lower and upper bounds still includes one point, the one both bounds share.

makeEmpty

set

  • Sets the lower and upper (x, y) boundaries of this box. Please note that this method only copies the values from the given objects.

    Parameters

    • min: I3JS.Vector2

      Vector2 representing the lower (x, y) boundary of the box.

    • max: I3JS.Vector2

      Vector2 representing the upper (x, y) boundary of the box.

    Returns I3JS.Box2

setFromCenterAndSize

setFromPoints

translate

union

  • Unions this box with box, setting the upper bound of this box to the greater of the two boxes' upper bounds and the lower bound of this box to the lesser of the two boxes' lower bounds.

    Parameters

    • box: I3JS.Box2

      Box that will be unioned with this box.

    Returns I3JS.Box2

Generated using TypeDoc