Description
The Contains
method of the BBox
struct checks if the current bounding box completely contains another bounding box. This method is useful for determining spatial relationships between bounding boxes, such as when checking if one object is entirely within another in a 3D space.
Usage
To use the Contains
method, you need to have two BBox
instances. Call the method on the first instance, passing the second instance by reference as a parameter. The method will return true
if the first bounding box completely contains the second bounding box, and false
otherwise.
Example
// Create two BBox instances
BBox box1 = new BBox(new Vector3(0, 0, 0), new Vector3(10, 10, 10));
BBox box2 = new BBox(new Vector3(2, 2, 2), new Vector3(5, 5, 5));
// Check if box1 contains box2
bool isContained = box1.Contains(ref box2);
// Output the result
// isContained will be true because box2 is entirely within box1