[name]

Represents a boundary box in 2D space.

Constructor

[name]( [page:Vector2 min], [page:Vector2 max] )

min -- Lower (x, y) boundary of the box.
max -- Upper (x, y) boundary of the box.
Creates a box bounded by min and max.

Properties

[property:Vector2 min]

Lower (x, y) boundary of this box.

[property:Vector2 max]

Upper (x, y) boundary of this box.

Methods

[method:Box2 set]( [page:Vector2 min], [page:Vector2 max] ) [page:Box2 this]

min -- Lower (x, y) boundary of the box.
max -- Upper (x, y) boundary of the box.
Sets the lower and upper (x, y) boundaries of this box.

[method:Box2 expandByPoint]( [page:Vector2 point] ) [page:Box2 this]

point -- Point that should be included in the box.
Expands the boundaries of this box to include *point*.

[method:Vector2 clampPoint]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]

point -- Position to clamp.
optionalTarget -- If specified, the clamped result will be copied here.
Clamps *point* within the bounds of this box.

[method:Boolean intersectsBox]( [page:Box2 box] ) [page:Box2 this]

box -- Box to check for intersection against.
Determines whether or not this box intersects *box*.

[method:Box2 setFromPoints]( [page:Array points] ) [page:Box2 this]

points -- Set of points that the resulting box will envelop.
Sets the upper and lower bounds of this box to include all of the points in *points*.

[method:Vector2 size]( [page:Vector2 optionalTarget] ) [page:Box2 this]

optionalTarget -- If specified, the result will be copied here.
Returns the width and height of this box.

[method:Box2 union]( [page:Box2 box] ) [page:Box2 this]

box -- Box that will be unioned with this box.
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.

[method:Vector2 getParameter]( [page:Vector2 point], [page:Vector2 optionalTarget] ) [page:Box2 this]

point -- [page:Vector2]
optionalTarget -- [page:Vector2]
Returns a point as a proportion of this box's width and height.

[method:Box2 expandByScalar]( [page:float scalar] ) [page:Box2 this]

scalar -- Distance to expand.
Expands each dimension of the box by *scalar*. If negative, the dimensions of the box
will be contracted.

[method:Box2 intersect]( [page:Box2 box] ) [page:Box2 this]

box -- Box to intersect with.
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.

[method:Boolean containsBox]( [page:Box2 box] ) [page:Box2 this]

box -- Box to test for inclusion.
Returns true if this box includes the entirety of *box*. If this and *box* overlap exactly,
this function also returns true.

[method:Box2 translate]( [page:Vector2 offset] ) [page:Box2 this]

offset -- Direction and distance of offset.
Adds *offset* to both the upper and lower bounds of this box, effectively moving this box
*offset* units in 2D space.

[method:Boolean isEmpty]() [page:Box2 this]

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.

[method:Box2 clone]() [page:Box2 this]

Returns a copy of this box.

[method:Boolean equals]( [page:Box2 box] ) [page:Box2 this]

box -- Box to compare.
Returns true if this box and *box* share the same lower and upper bounds.

[method:Box2 expandByVector]( [page:Vector2 vector] ) [page:Box2 this]

vector -- Amount to expand this box in each dimension.
Expands this box equilaterally by *vector*. The width of this box will be expanded by the x component of *vector* in both directions. The height of this box will be expanded by the y component of *vector* in both directions.

[method:Box2 copy]( [page:Box2 box] ) [page:Box2 this]

box -- Box to copy.
Copies the values of *box* to this box.

[method:Box2 makeEmpty]() [page:Box2 this]

Makes this box empty.

[method:Vector2 center]( [page:Vector2 optionalTarget] ) [page:Box2 this]

optionalTarget -- If specified, the result will be copied here.
Returns the center point of this box.

[method:Float distanceToPoint]( [page:Vector2 point] ) [page:Box2 this]

point -- Point to measure distance to.
Returns the distance from any edge of this box to the specified point.
If the point lies inside of this box, the distance will be 0.

[method:Boolean containsPoint]( [page:Vector2 point] ) [page:Box2 this]

point -- [page:Vector2] to check for inclusion.
Returns true if the specified point lies within the boundaries of this box.

[method:Box2 setFromCenterAndSize]( [page:Vector2 center], [page:Vector2 size] ) [page:Box2 this]

center -- Desired center position of the box.
size -- Desired x and y dimensions of the box.
Centers this box on *center* and sets this box's width and height to the values specified in *size*.

Source

[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]