public static BoundingBox CreateFromPoints(IList<Vector3> points)
{
BoundingBox aabb;
if (points.Count == 0)
throw new Exception("Cannot construct a bounding box from an empty list.");
aabb.Min = points[0];
aabb.Max = aabb.Min;
for (int i = points.Count - 1; i >= 1; i--)
{
aabb.Min = Vector3.Min(points[i], aabb.Min);
aabb.Max = Vector3.Max(points[i], aabb.Max);
}
return aabb;
}