#region CPL License /* Nuclex Framework Copyright (C) 2002-2008 Nuclex Development Labs This library is free software; you can redistribute it and/or modify it under the terms of the IBM Common Public License as published by the IBM Corporation; either version 1.0 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the IBM Common Public License for more details. You should have received a copy of the IBM Common Public License along with this library */ #endregion using System; using System.Collections.Generic; using Microsoft.Xna.Framework; namespace Nuclex.Support.SpatialPartitioning { /// Two-dimensional bounding rectangle internal struct BoundingRectangle { /// Initializes a new two-dimensional bounding rectangle /// Lesser coordinates of the bounding rectangle /// Greater coordinates of the bounding rectangle public BoundingRectangle(Vector2 min, Vector2 max) { this.Min = min; this.Max = max; } /// /// Builds the smallest bounding rectangle that contains the two /// specified bounding rectangle. /// /// One of the bounding rectangles to contain /// One of the bounding rectangles to contain /// The resulting merged bounding rectangle public static BoundingRectangle CreateMerged( BoundingRectangle original, BoundingRectangle additional ) { BoundingRectangle result; CreateMerged(ref original, ref additional, out result); return result; } /// /// Builds the smallest bounding rectangle that contains the two /// specified bounding rectangle. /// /// One of the bounding rectangles to contain /// One of the bounding rectangles to contain /// The resulting merged bounding rectangle public static void CreateMerged( ref BoundingRectangle original, ref BoundingRectangle additional, out BoundingRectangle result ) { result = new BoundingRectangle(); result.Min = Vector2.Min(original.Min, additional.Min); result.Max = Vector2.Max(original.Max, additional.Max); } /// Coordinates of the lesser side of the bounding rectangle public Vector2 Min; /// Coordinates of the greater side of the bounding rectangle public Vector2 Max; } } // namespace Nuclex.Support.SpatialPartitioning