Пример #1
0
        public static BoundingBox CreateFromPoints(params Vector[] points)
        {
            if (points == null)
            {
                throw new ArgumentNullException("points");
            }

            if (points.Length == 0)
            {
                throw new ArgumentException("points");
            }

            Vector min = points[0];
            Vector max = points[1];

            for (int i = 1; i < points.Length; i++)
            {
                min = Vector.Min(min, points[i]);
                max = Vector.Max(max, points[i]);
            }

            return(new BoundingBox {
                Min = min, Max = max
            });
        }
Пример #2
0
 public BoundingBox UnionWith(BoundingBox other)
 {
     return(new BoundingBox {
         Min = Vector.Min(this.Min, other.Min), Max = Vector.Max(this.Max, other.Max)
     });
 }