Description
The AddPoint
method is used to expand the bounding box (BBox
) to include a specified point. This method modifies the bounding box such that it encompasses the given point, effectively adjusting the minimum and maximum extents of the bounding box if the point lies outside the current bounds.
Usage
To use the AddPoint
method, you need to have an instance of BBox
and a Vector3
point that you want to include within the bounding box. The method will adjust the bounding box to ensure the point is within its bounds.
Example
// Create a new BBox
BBox bbox = new BBox(new Vector3(0, 0, 0), new Vector3(1, 1, 1));
// Define a point to add
Vector3 point = new Vector3(2, 2, 2);
// Add the point to the bounding box
bbox = bbox.AddPoint(ref point);
// The bbox now includes the point (2, 2, 2) and has expanded accordingly.