## Libraries.Game.BoundingBox Documentation

This class specifies the size and the location of a box that will surround other 3D objects. The box is used in collision detection.

*Inherits from: *Libraries.Language.Object

## Summary

### Actions Summary Table

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

CalculateDimensions() | This is tested using the Separating Axis Theore |

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

Combine(Libraries.Game.BoundingBox box1, Libraries.Game.BoundingBox box2) | This action will test to see if this BoundingBox intersects with the given BoundingBox. |

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

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

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

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

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

Extend(Libraries.Game.BoundingBox bounds, Libraries.Compute.Matrix4 transform) | This action will extend the BoundingBox to contain the given BoundingBox, offset by the given Matrix4. |

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

Extend(Libraries.Compute.Vector3 center, number radius) | This action will extend the BoundingBox to contain a sphere denoted by a center point and a radius. |

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

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

GetCenter() | GetCenter will return a Vector3 object containing the point at the center of the BoundingBox. |

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

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

GetCenterZ() | GetCenterZ will return the Z coordinate of the center of the BoundingBox. |

GetDepth() | GetDepth will return the height of the BoundingBox. |

GetDimensions() | GetDimensions will return the width, height, and depth of the BoundingBox, stored within a Vector3 object. |

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

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

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

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

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

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

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

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

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

Multiply(Libraries.Compute.Matrix4 transform) | This action will multiply the size of the region of the BoundingBox by the values contained in the given Matrix4. |

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

Set(Libraries.Containers.Array<Libraries.Compute.Vector3> points) | Providing the Set action with an array of points will set the BoundingBox to the minimum possible size that contains all of the given points. |

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

TestOverlap(Libraries.Game.BoundingBox boundingBox) | This action returns the perimeter of the BoundingBox2D. |

## Actions Documentation

### CalculateDimensions()

This is tested using the Separating Axis Theore

### Clear()

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

### Combine(Libraries.Game.BoundingBox box1, Libraries.Game.BoundingBox box2)

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

#### Parameters

### 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 (smaller)
```

#### Parameters

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

#### Return

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

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

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

#### Parameters

#### Return

boolean:

### Contains(Libraries.Game.BoundingBox bounds)

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

#### Parameters

#### Return

boolean:

### Copy()

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

#### Return

### 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(t)
```

#### 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(Libraries.Game.BoundingBox bounds, Libraries.Compute.Matrix4 transform)

This action will extend the BoundingBox to contain the given BoundingBox, offset by the given Matrix4.

#### Parameters

### Extend(number x, number y, number z)

This action will extend the BoundingBox to contain the point at the given X, Y, and Z coordinates.

#### Parameters

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

This action will extend the BoundingBox to contain a sphere denoted by a center point and a radius.

#### Parameters

### Extend(Libraries.Game.BoundingBox bounds)

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

#### Parameters

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

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

#### Parameters

### GetCenter()

GetCenter will return a Vector3 object containing the point at the center of the BoundingBox.

#### Return

### GetCenterX()

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

#### Return

number:

### GetCenterY()

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

#### Return

number:

### GetCenterZ()

GetCenterZ will return the Z coordinate of the center of the BoundingBox.

#### Return

number:

### GetDepth()

GetDepth will return the height of the BoundingBox.

#### Return

number:

### GetDimensions()

GetDimensions will return the width, height, and depth of the BoundingBox, stored within a Vector3 object.

#### Return

### 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 BoundingBox.

#### Return

number:

### GetMaximum()

GetMaximum will return the "maximum" point of the BoundingBox. This is specifically the point of the BoundingBox with the highest X, Y, and Z values. The point will be returned as a Vector3.

#### Return

### GetMinimum()

GetMinimum will return the "minimum" point of the BoundingBox. This is specifically the point of the BoundingBox with the lowest X, Y, and Z values. The point will be returned as a Vector3.

#### Return

### GetPerimeter()

This action returns the perimeter of the BoundingBox2D.

#### Return

number:

### GetWidth()

GetWidth will return the width of the BoundingBox.

#### Return

number:

### Intersects(Libraries.Game.BoundingBox bounds)

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

#### Parameters

#### Return

boolean:

### Invalidate()

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

### IsValid()

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

#### Return

boolean:

### Multiply(Libraries.Compute.Matrix4 transform)

This action will multiply the size of the region of the BoundingBox by the values contained in the given Matrix4.

#### Parameters

### Set(Libraries.Game.BoundingBox bounds)

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

#### Parameters

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

Providing the Set action with an array of points will set the BoundingBox to the minimum possible size that contains all of the given points.

#### Parameters

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

The Set action can be provided with a pair of vectors to set the bounds of this BoundingBox. The first vector should represent the "minimum" point of the bounds, or the point with the lowest X, Y, and Z values. The second vector should represent the "maximum" point of the bounds, or the point with the highest X, Y, and Z values.

#### Parameters

### TestOverlap(Libraries.Game.BoundingBox boundingBox)

This action returns the perimeter of the BoundingBox2D.

#### Parameters

#### Return

boolean: