## Libraries.Game.Collision.BoundingBox2D Documentation

This class represents a 2D box that bounds an 2D item. The box approximates the size of the 2D items. The box is defined by two Vector2 objects which represent the maximum and minimum points of the item. This class is used throughout the Collision libraries to monitor collisions. The box is not allowed to rotate, therefore, we call these boxes "axis-aligned bounding boxes".

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The center of the bounding box is (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ")
```

*Inherits from: *Libraries.Language.Object

## Summary

### Actions Summary Table

Actions | Description |
---|---|

CalculateDimensions() | This action re-calculates the center and the dimensions of the BoundingBox2D. |

Clear() | This action will clear out the values of the BoundingBox2D, resetting all of its values to zero. |

Combine(Libraries.Game.Collision.BoundingBox2D box1, Libraries.Game.Collision.BoundingBox2D box2) | This action combines two given boundingBox to create the bounds of this BoundingBox2D. |

Compare(Libraries.Language.Object object) | This action compares two object hash codes and returns an integer. |

Contains(Libraries.Game.Collision.BoundingBox2D bounds) | This action will test to see if this BoundingBox2D totally contains a given BoundingBox. |

Contains(Libraries.Compute.Vector2 point) | This action will test to see if the point indicated by the given Vector2 is contained inside this BoundingBox2D. |

Copy() | The Copy action will return a new BoundingBox2D with the same bounds as this BoundingBox2D. |

Equals(Libraries.Language.Object object) | This action determines if two objects are equal based on their hash code values. |

Extend(number x, number y) | This action will extend the BoundingBox2D to contain the point at the given X and Y coordinates. |

Extend(Libraries.Compute.Vector2 center, number radius) | This action will extend the BoundingBox2D to contain a circle denoted by a center point and a radius. |

Extend(Libraries.Game.Collision.BoundingBox2D bounds) | This action will extend the BoundingBox2D to contain the provided bounds. |

Extend(Libraries.Compute.Vector2 point) | This action will extend the BoundingBox2D to include the given point. |

GetCenter() | GetCenter will return a Vector2 object containing the point at the center of the BoundingBox2D. |

GetCenterX() | GetCenterX will return the X coordinate of the center of the BoundingBox2D. |

GetCenterY() | GetCenterY will return the Y coordinate of the center of the BoundingBox2D. |

GetDimensions() | GetDimensions will return the width and height of the BoundingBox2D stored within a Vector2 object. |

GetHashCode() | This action gets the hash code for an object. |

GetHeight() | GetHeight will return the height of the BoundingBox2D. |

GetMaximum() | GetMaximum will return the "maximum" point of the BoundingBox2D. |

GetMinimum() | GetMinimum will return the "minimum" point of the BoundingBox2D. |

GetPerimeter() | This action returns the perimeter of the BoundingBox2D. |

GetWidth() | GetWidth will return the width of the BoundingBox2D. |

Intersects(Libraries.Game.Collision.BoundingBox2D bounds) | This action will test to see if this BoundingBox2D intersects with the given BoundingBox2D. |

Invalidate() | This action will invalidate the BoundingBox2D, setting its minimum values to positive infinity and setting its maximum values to negative infinity. |

IsValid() | This action will return whether or not the BoundingBox2D defines a real, 2-dimensional area. |

Set(Libraries.Compute.Vector2 min, Libraries.Compute.Vector2 max) | The Set action can be provided with a pair of vectors to set the bounds of this BoundingBox2D. |

Set(Libraries.Game.Collision.BoundingBox2D bounds) | When provided with a BoundingBox2D as a parameter, the Set action will set the BoundingBox2D to match the bounds of the parameter. |

Set(Libraries.Containers.Array<Libraries.Compute.Vector2> points) | This action will set the BoundingBox2D to the minimum possible size that contains all of the points in the given array. |

TestOverlap(Libraries.Game.Collision.BoundingBox2D boundingBox) | This action tests for overlap between the given BoundingBox2D and this BoundingBox2D |

## Actions Documentation

### CalculateDimensions()

This action re-calculates the center and the dimensions of the BoundingBox2D. This action is used internally. Note that center and dimensions are calculated when minimum and maximum are se

### Clear()

This action will clear out the values of the BoundingBox2D, resetting all of its values to zero.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
boundingBox:Clear()
output "After clearing, the box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight
```

### Combine(Libraries.Game.Collision.BoundingBox2D box1, Libraries.Game.Collision.BoundingBox2D box2)

This action combines two given boundingBox to create the bounds of this BoundingBox2D. CalculateDimensions() should be called after this action to get center, width, and height.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
BoundingBox2D addition
Vector2 minimum2
Vector2 maximum2
minimum:Set(2, 2)
maximum:Set(0.9, 0.9)
addition:Set(minimum, maximum)
output "The second box is centered at (" + addition:GetCenterX()
+ ", " + addition:GetCenterY() + ") with a width of "
+ addition:GetWidth() + " and a height of " + addition:GetHeight()
BoundingBox2D result
result:Combine(boundingBox, addition)
result:CalculateDimensions()
output "The box, resulting from the combination, is centered at (" + result:GetCenterX()
+ ", " + result:GetCenterY() + ") with a width of "
+ result:GetWidth() + " and a height of " + result:GetHeight
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The first box to be combined
- Libraries.Game.Collision.BoundingBox2D: The second box to be combined

### Compare(Libraries.Language.Object object)

This action compares two object hash codes and returns an integer. The result is larger if this hash code is larger than the object passed as a parameter, smaller, or equal. In this case, -1 means smaller, 0 means equal, and 1 means larger. This action was changed in Quorum 7 to return an integer, instead of a CompareResult object, because the previous implementation was causing efficiency issues.

**Example Code**

```
Object o
Object t
integer result = o:Compare(t) //1 (larger), 0 (equal), or -1 (smalle
```

#### Parameters

- Libraries.Language.Object: The object to compare to.

#### Return

integer: The Compare result, Smaller, Equal, or Larger.

### Contains(Libraries.Game.Collision.BoundingBox2D bounds)

This action will test to see if this BoundingBox2D totally contains a given BoundingBox. If any part of the given BoundingBox2D is outside this one, it will return false.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
BoundingBox2D addition
Vector2 minimum2
Vector2 maximum2
minimum:Set(2, 2)
maximum:Set(1.5, 1.5)
addition:Set(minimum, maximum)
if not boundingBox:Contains(addition)
boundingBox:Extend(addition)
end
output "The box, with the addition, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The bounding box to be checked against this bounding box.

#### Return

boolean: whether the given bounding box is completely contained in this bounding box.

### Contains(Libraries.Compute.Vector2 point)

This action will test to see if the point indicated by the given Vector2 is contained inside this BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
Vector2 outlier
outlier:Set(5,2)
if not boundingBox:Contains(outlier)
boundingBox:Extend(outlier)
end
output "The box, with the outlier, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Compute.Vector2: The point to check for within the bounds of this BoundingBox2D

#### Return

boolean: whether the point is contained in this BoundingBox2D

### Copy()

The Copy action will return a new BoundingBox2D with the same bounds as this BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
BoundingBox2D copy
copy:Set(boundingBox:Copy(
```

#### Return

Libraries.Game.Collision.BoundingBox2D: an equivalent bounding box

### Equals(Libraries.Language.Object object)

This action determines if two objects are equal based on their hash code values.

**Example Code**

```
use Libraries.Language.Object
use Libraries.Language.Types.Text
Object o
Text t
boolean result = o:Equals(
```

#### Parameters

- Libraries.Language.Object: The to be compared.

#### Return

boolean: True if the hash codes are equal and false if they are not equal.

### Extend(number x, number y)

This action will extend the BoundingBox2D to contain the point at the given X and Y coordinates.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
number outlierX = 5
number outlierY = 2
boundingBox:Extend(outlierX, outlierY)
output "The box, including the outlier, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- number x: The x value of the point to be included
- number y: The y value of the point to be included

### Extend(Libraries.Compute.Vector2 center, number radius)

This action will extend the BoundingBox2D to contain a circle denoted by a center point and a radius.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
Vector2 circleCenter
circleCenter:Set(1, 1)
number radius = 1.5
boundingBox:Extend(circleCenter, radius)
output "The box, now also containing the circle, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Compute.Vector2: The center point of the circle to be included in the extended BoundingBox2D
- number radius: the radius of the circle to be included in the extended BoundingBox2D

### Extend(Libraries.Game.Collision.BoundingBox2D bounds)

This action will extend the BoundingBox2D to contain the provided bounds.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
Vector2 maximum2
Vector2 minimum2
maximum2:Set(2, 2)
minimum2:Set(1.5, 1.5)
BoundingBox2D addition
addition:Set(minimum2, maximum2)
boundingBox:Extend(addition)
output "The box, with the additional bounds, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The bounding box that this bounding box is to be extended to include.

### Extend(Libraries.Compute.Vector2 point)

This action will extend the BoundingBox2D to include the given point.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
Vector2 outlier
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
outlier:Set(5, 2)
boundingBox:Extend(outlier)
output "The box, including the outlier, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Compute.Vector2: The point that is to be included in the extended BoundingBox2D.

### GetCenter()

GetCenter will return a Vector2 object containing the point at the center of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
Vector2 center = boundingBox:GetCenter()
output "The center of the bounding box is (" + center:GetX()
+ ", " + center:GetY() + ")
```

#### Return

Libraries.Compute.Vector2: the center point of the BoundingBox2D as a Vector2D

### GetCenterX()

GetCenterX will return the X coordinate of the center of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The center of the bounding box is (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ")
```

#### Return

number: the X coordinate of the center point of the BoundingBox2D.

### GetCenterY()

GetCenterY will return the Y coordinate of the center of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The center of the bounding box is (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ")
```

#### Return

number: the Y coordinate of the center point of the BoundingBox2D.

### GetDimensions()

GetDimensions will return the width and height of the BoundingBox2D stored within a Vector2 object.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
Vector2 dimensions = boundingBox:GetDimensions()
output "The bounding box is " + dimensions:GetX()
+ " wide by " + dimensions:GetY() + " tall.
```

#### Return

Libraries.Compute.Vector2: the width and height of the BoundingBox2D stored as the X and Y coordinates of the Vector2 object, respectively.

### GetHashCode()

This action gets the hash code for an object.

**Example Code**

```
Object o
integer hash = o:GetHashCode
```

#### Return

integer: The integer hash code of the object.

### GetHeight()

GetHeight will return the height of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The bounding box is " + boundingBox:GetWidth()
+ " wide by " + boundingBox:GetHeight() + " tall.
```

#### Return

number: the height of the BoundingBox2D

### GetMaximum()

GetMaximum will return the "maximum" point of the BoundingBox2D. This is specifically the point of the BoundingBox2D with the highest X and Y values. The point will be returned as a Vector2.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The maximum of the bounding box is (" + boundingBox:GetMaximum():GetX()
+ ", " + boundingBox:GetMaximum():GetY() + "
```

#### Return

Libraries.Compute.Vector2: the maximum point of the BoundingBox2D

### GetMinimum()

GetMinimum will return the "minimum" point of the BoundingBox2D. This is specifically the point of the BoundingBox2D with the lowest X and Y values. The point will be returned as a Vector2.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The minimum of the bounding box is (" + boundingBox:GetMinimum():GetX()
+ ", " + boundingBox:GetMinimum():GetY() + "
```

#### Return

Libraries.Compute.Vector2: the minimum point of the BoundingBox2D

### GetPerimeter()

This action returns the perimeter of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box has perimeter " + boundingBox:GetPerimeter
```

#### Return

number: the perimeter of this BoundingBox2D

### GetWidth()

GetWidth will return the width of the BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The bounding box is " + boundingBox:GetWidth()
+ " wide by " + boundingBox:GetHeight() + " tall.
```

#### Return

number: the width of the BoundingBox2D

### Intersects(Libraries.Game.Collision.BoundingBox2D bounds)

This action will test to see if this BoundingBox2D intersects with the given BoundingBox2D.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
BoundingBox2D addition
Vector2 minimum2
Vector2 maximum2
minimum:Set(2, 2)
maximum:Set(0.9, 0.9)
addition:Set(minimum, maximum)
if boundingBox:Intersects(addition)
boundingBox:Extend(addition)
end
output "The box, with the addition, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The bounding box to be checked for intersection against this bounding box.

#### Return

boolean: whether the given bounding box intersects this bounding box.

### Invalidate()

This action will invalidate the BoundingBox2D, setting its minimum values to positive infinity and setting its maximum values to negative infinity.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
Vector2 newMaximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
newMaximum:Set(5, 2)
boundingBox:Invalidate()
boundingBox:Extend(minimum)
boundingBox:Extend(newMaximum)
output "The box, with the new maximum, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

### IsValid()

This action will return whether or not the BoundingBox2D defines a real, 2-dimensional area. This requires all of the values of the "minimum" point to be less than the values of the "maximum" point.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
if boundingBox:IsValid()
output "The box is valid"
else
output "The box is invalid"
end
output "Invalidating..."
boundingBox:Invalidate()
if boundingBox:IsValid()
output "The box is valid"
else
output "The box is invalid"
e
```

#### Return

boolean: whether the bounding box is valid.

### Set(Libraries.Compute.Vector2 min, Libraries.Compute.Vector2 max)

The Set action can be provided with a pair of vectors to set the bounds of this BoundingBox2D. The first vector should represent the "minimum" point of the bounds, or the point with the lowest X and Y values. The second vector should represent the "maximum" point of the bounds, or the point with the highest X and Y values. This action will also calculate the center and dimensions of the BoundingBox2D given the maximum and minimum points.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximu
```

#### Parameters

- Libraries.Compute.Vector2: The Vector2D representing the minimum point of the bounds
- Libraries.Compute.Vector2: The Vector2D representing the maximum point of the bounds

### Set(Libraries.Game.Collision.BoundingBox2D bounds)

When provided with a BoundingBox2D as a parameter, the Set action will set the BoundingBox2D to match the bounds of the parameter.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
BoundingBox2D copy
copy:Set(boundingBox:Copy(
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The BoundingBox2D to set this bounding box equivalent to

### Set(Libraries.Containers.Array<Libraries.Compute.Vector2> points)

This action will set the BoundingBox2D to the minimum possible size that contains all of the points in the given array.

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 point1 //the minimum point of the boundingBox
Vector2 point2 //the maximum point of the boundingBox
Vector2 outlier //the outlier in addition to the original boundingBox
point1:Set(-1, -1)
point2:Set(1, 1)
outlier:Set(5, 2)
Array<Vector2> points
//you would want to include the minimum and the maximum points of the
//original bounding box if you want to add an extra outlier
//(another way to do this is to use the Extend(Vector2 point) action)
//but if you just want to bound a series of points, you just have to insert
//the points that you want the box to bound
points:Add(point1)
points:Add(point2)
points:Add(outlier)
boundingBox:Set(points)
output "The box, including the outlier, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Containers.Array: The array of points to be contained in the BoundingBox2D.

### TestOverlap(Libraries.Game.Collision.BoundingBox2D boundingBox)

This action tests for overlap between the given BoundingBox2D and this BoundingBox2D

**Example Code**

```
use Libraries.Game.Collision.BoundingBox2D
use Libraries.Compute.Vector2
use Libraries.Containers.Array
BoundingBox2D boundingBox
Vector2 minimum
Vector2 maximum
minimum:Set(-1, -1)
maximum:Set(1, 1)
boundingBox:Set(minimum, maximum)
output "The box is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and an height of " + boundingBox:GetHeight()
BoundingBox2D addition
Vector2 minimum2
Vector2 maximum2
minimum:Set(2, 2)
maximum:Set(0.9, 0.9)
addition:Set(minimum, maximum)
if boundingBox:TestOverlap(addition)
boundingBox:Extend(addition)
end
output "The box, with the addition, is centered at (" + boundingBox:GetCenterX()
+ ", " + boundingBox:GetCenterY() + ") with a width of "
+ boundingBox:GetWidth() + " and a height of " + boundingBox:GetHeight
```

#### Parameters

- Libraries.Game.Collision.BoundingBox2D: The bounding box to be checked for overlap with this bounding box.

#### Return

boolean: whether the given bounding box overlaps with this bounding box.