BoundingBox StructureDelta Engine Documentation
Min and max vector for a 3D bounding box. Can also be used to calculate a BoundingSphere. View code on GitHub

Namespace: DeltaEngine.Datatypes
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public struct BoundingBox : IEquatable<BoundingBox>

The BoundingBox type exposes the following members.

Constructors

  NameDescription
Public methodBoundingBox(IList Vector3D )
Initializes a new instance of the BoundingBox class
Public methodBoundingBox(Vector3D, Vector3D)
Initializes a new instance of the BoundingBox class
Top
Methods

  NameDescription
Public methodEquals(Object) (Overrides ValueType Equals(Object).)
Public methodEquals(BoundingBox)
Public methodStatic memberFromCenter
Public methodGetHashCode (Overrides ValueType GetHashCode .)
Public methodIntersect
Public methodIsColliding(BoundingBox)
Public methodIsColliding(BoundingSphere)
Public methodIsNearlyEqual
Public methodMerge
Top
Fields

  NameDescription
Public fieldMax
Public fieldMin
Top
Remarks

Tests: DeltaEngine.Tests.Datatypes.BoundingBoxTests
Examples

12 unit tests call DeltaEngine.Datatypes.BoundingBox
[Test]
public void CreateBoundingBoxFromMinAndMax()
{
    var boundingBox = new BoundingBox(Vector3D.Zero, Vector3D.One);
    Assert.AreEqual(Vector3D.Zero, boundingBox.Min);
    Assert.AreEqual(Vector3D.One, boundingBox.Max);
}
[Test]
public void CreateBoundingBoxFromCenter()
{
    var box = BoundingBox.FromCenter(Vector3D.Zero, Vector3D.One);
    Assert.AreEqual(-Vector3D.One / 2, box.Min);
    Assert.AreEqual(Vector3D.One / 2, box.Max);
}
[Test]
public void CreateBoundingBoxByPoints()
{
    Assert.Throws<BoundingBox.NoPointsSpecified>(() => new BoundingBox(null));
    Assert.Throws<BoundingBox.NoPointsSpecified>(() => new BoundingBox(new Vector3D[0]));
    var points = new[] { new Vector3D(2, 5, 7), new Vector3D(6, 4, 2), new Vector3D(1, 7, 9), };
    var boundingBox = new BoundingBox(points);
    Assert.AreEqual(boundingBox.Min, new Vector3D(1, 4, 2));
    Assert.AreEqual(boundingBox.Max, new Vector3D(6, 7, 9));
}
See Also