static BBox FromPoints( IEnumerable<Vector3> points, float size )

book_4_sparkGenerated
code_blocksInput

Description

The FromPoints method creates an axis-aligned bounding box (AABB) that encompasses a collection of 3D points. This method is useful for determining the bounding box of a set of points in 3D space, which can be used for collision detection, visibility testing, or spatial partitioning.

Usage

To use the FromPoints method, provide a collection of Vector3 points and a size value. The method will calculate the minimum and maximum extents of the bounding box that can contain all the provided points, adjusted by the specified size.

Example

// Example usage of BBox.FromPoints
var points = new List<Vector3>
{
    new Vector3(1, 2, 3),
    new Vector3(4, 5, 6),
    new Vector3(-1, -2, -3)
};

float size = 0.5f;
BBox boundingBox = BBox.FromPoints(points, size);

// boundingBox now contains the AABB that encompasses all the points with the specified size adjustment.