Min and max vector for a 3D bounding box. Can also be used to calculate a BoundingSphere.
View code on GitHub
Namespace: DeltaEngine.DatatypesAssembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The BoundingBox type exposes the following members.
Constructors
Name | Description | |
---|---|---|
BoundingBox(IList Vector3D ) | Initializes a new instance of the BoundingBox class | |
BoundingBox(Vector3D, Vector3D) | Initializes a new instance of the BoundingBox class |
Methods
Fields
Name | Description | |
---|---|---|
Max | ||
Min |
Remarks
Examples
[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