BBox AddPoint( Vector3& point )

book_4_sparkGenerated
code_blocksInput

Description

The AddPoint method is used to expand the bounding box to include a specified point. This method modifies the bounding box such that it encompasses the given point, adjusting its minimum and maximum extents as necessary.

Usage

To use the AddPoint method, you need to have an instance of the BBox struct. You can then call this method with a reference to a Vector3 point that you want to include within the bounding box. The method will return a new BBox instance that represents the expanded bounding box.

Example

// Create a bounding box
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);

// Expand the bounding box to include the point
BBox expandedBBox = bbox.AddPoint(ref point);

// The expandedBBox now includes the point (2, 2, 2)