Class BoundingBox
Defines an axis-aligned box-shaped 3D volume.
Inheritance
System.Object
BoundingBox
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingBox : ValueType, IEquatable<BoundingBox>
Constructors
BoundingBox(BoundingBoxD)
Creates an instance of BoundingBox from BoundingBoxD (helper for transformed BBs)
Declaration
public BoundingBox(BoundingBoxD bbd)
Parameters
BoundingBox(BoundingBoxI)
Creates an instance of BoundingBox from BoundingBoxI
Declaration
public BoundingBox(BoundingBoxI bbd)
Parameters
BoundingBox(Vector3, Vector3)
Creates an instance of BoundingBox.
Declaration
public BoundingBox(Vector3 min, Vector3 max)
Parameters
| Type |
Name |
Description |
| Vector3 |
min |
The minimum point the BoundingBox includes.
|
| Vector3 |
max |
The maximum point the BoundingBox includes.
|
Fields
Comparer
Declaration
public static readonly BoundingBox.ComparerType Comparer
Field Value
CornerCount
Specifies the total number of corners (8) in the BoundingBox.
Declaration
public const int CornerCount = 8
Field Value
| Type |
Description |
| System.Int32 |
|
Invalid
Declaration
public static readonly BoundingBox Invalid
Field Value
Max
The maximum point the BoundingBox contains.
Declaration
Field Value
Min
The minimum point the BoundingBox contains.
Declaration
Field Value
Properties
Center
Declaration
public Vector3 Center { get; }
Property Value
Corners
Declaration
public BoxCornerEnumerator Corners { get; set; }
Property Value
Depth
Declaration
public float Depth { get; }
Property Value
| Type |
Description |
| System.Single |
|
Extents
Declaration
public Vector3 Extents { get; }
Property Value
HalfExtents
Declaration
public Vector3 HalfExtents { get; }
Property Value
Height
Declaration
public float Height { get; }
Property Value
| Type |
Description |
| System.Single |
|
Matrix
Matrix of AABB, respecting center and size
Declaration
public Matrix Matrix { get; }
Property Value
Perimeter
return perimeter of edges
Declaration
public float Perimeter { get; }
Property Value
| Type |
Description |
| System.Single |
|
Size
Declaration
public Vector3 Size { get; }
Property Value
Width
Declaration
public float Width { get; }
Property Value
| Type |
Description |
| System.Single |
|
Methods
Contains(BoundingBox)
Tests whether the BoundingBox contains another BoundingBox.
Declaration
public ContainmentType Contains(BoundingBox box)
Parameters
| Type |
Name |
Description |
| BoundingBox |
box |
The BoundingBox to test for overlap.
|
Returns
Contains(ref BoundingBox, out ContainmentType)
Tests whether the BoundingBox contains a BoundingBox.
Declaration
public void Contains(ref BoundingBox box, out ContainmentType result)
Parameters
| Type |
Name |
Description |
| BoundingBox |
box |
The BoundingBox to test for overlap.
|
| ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(BoundingFrustum)
Tests whether the BoundingBox contains a BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustum frustum)
Parameters
| Type |
Name |
Description |
| BoundingFrustum |
frustum |
The BoundingFrustum to test for overlap.
|
Returns
Contains(BoundingSphere)
Tests whether the BoundingBox contains a BoundingSphere.
Declaration
public ContainmentType Contains(BoundingSphere sphere)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to test for overlap.
|
Returns
Contains(ref BoundingSphere, out ContainmentType)
Tests whether the BoundingBox contains a BoundingSphere.
Declaration
public void Contains(ref BoundingSphere sphere, out ContainmentType result)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to test for overlap.
|
| ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(Vector3)
Tests whether the BoundingBox contains a point.
Declaration
public ContainmentType Contains(Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
The point to test for overlap.
|
Returns
Contains(ref Vector3, out ContainmentType)
Tests whether the BoundingBox contains a point.
Declaration
public void Contains(ref Vector3 point, out ContainmentType result)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
The point to test for overlap.
|
| ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(Vector3D)
Declaration
public ContainmentType Contains(Vector3D point)
Parameters
Returns
CreateFromHalfExtent(Vector3, Single)
Declaration
public static BoundingBox CreateFromHalfExtent(Vector3 center, float halfExtent)
Parameters
| Type |
Name |
Description |
| Vector3 |
center |
|
| System.Single |
halfExtent |
|
Returns
CreateFromHalfExtent(Vector3, Vector3)
Declaration
public static BoundingBox CreateFromHalfExtent(Vector3 center, Vector3 halfExtent)
Parameters
Returns
CreateFromPoints(IEnumerable<Vector3>)
Creates the smallest BoundingBox that will contain a group of points.
Declaration
public static BoundingBox CreateFromPoints(IEnumerable<Vector3> points)
Parameters
| Type |
Name |
Description |
| System.Collections.Generic.IEnumerable<Vector3> |
points |
A list of points the BoundingBox should contain.
|
Returns
CreateFromSphere(BoundingSphere)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.
Declaration
public static BoundingBox CreateFromSphere(BoundingSphere sphere)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to contain.
|
Returns
CreateFromSphere(ref BoundingSphere, out BoundingBox)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.
Declaration
public static void CreateFromSphere(ref BoundingSphere sphere, out BoundingBox result)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to contain.
|
| BoundingBox |
result |
[OutAttribute] The created BoundingBox.
|
CreateInvalid()
Declaration
public static BoundingBox CreateInvalid()
Returns
CreateMerged(BoundingBox, BoundingBox)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
Declaration
public static BoundingBox CreateMerged(BoundingBox original, BoundingBox additional)
Parameters
| Type |
Name |
Description |
| BoundingBox |
original |
One of the BoundingBoxs to contain.
|
| BoundingBox |
additional |
One of the BoundingBoxs to contain.
|
Returns
CreateMerged(ref BoundingBox, ref BoundingBox, out BoundingBox)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
Declaration
public static void CreateMerged(ref BoundingBox original, ref BoundingBox additional, out BoundingBox result)
Parameters
| Type |
Name |
Description |
| BoundingBox |
original |
One of the BoundingBox instances to contain.
|
| BoundingBox |
additional |
One of the BoundingBox instances to contain.
|
| BoundingBox |
result |
[OutAttribute] The created BoundingBox.
|
Distance(Vector3)
Declaration
public float Distance(Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
|
Returns
| Type |
Description |
| System.Single |
|
DistanceSquared(Vector3)
Declaration
public float DistanceSquared(Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
|
Returns
| Type |
Description |
| System.Single |
|
Equals(Object)
Determines whether two instances of BoundingBox are equal.
Declaration
public override bool Equals(object obj)
Parameters
| Type |
Name |
Description |
| System.Object |
obj |
The Object to compare with the current BoundingBox.
|
Returns
| Type |
Description |
| System.Boolean |
|
Equals(BoundingBox)
Determines whether two instances of BoundingBox are equal.
Declaration
public bool Equals(BoundingBox other)
Parameters
| Type |
Name |
Description |
| BoundingBox |
other |
The BoundingBox to compare with the current BoundingBox.
|
Returns
| Type |
Description |
| System.Boolean |
|
Equals(BoundingBox, Single)
Declaration
public bool Equals(BoundingBox other, float epsilon)
Parameters
| Type |
Name |
Description |
| BoundingBox |
other |
|
| System.Single |
epsilon |
|
Returns
| Type |
Description |
| System.Boolean |
|
GetCorners()
Gets an array of points that make up the corners of the BoundingBox. ALLOCATION!
Declaration
public Vector3[] GetCorners()
Returns
GetCorners(Vector3[])
Gets the array of points that make up the corners of the BoundingBox.
Declaration
public void GetCorners(Vector3[] corners)
Parameters
| Type |
Name |
Description |
| Vector3[] |
corners |
An existing array of at least 8 Vector3 points where the corners of the BoundingBox are written.
|
GetCornersUnsafe(Vector3*)
Gets the array of points that make up the corners of the BoundingBox.
Declaration
public void GetCornersUnsafe(Vector3*corners)
Parameters
| Type |
Name |
Description |
| Vector3* |
corners |
An existing array of at least 8 Vector3 points where the corners of the BoundingBox are written.
|
GetHashCode()
Gets the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
| Type |
Description |
| System.Int32 |
|
GetIncluded(Vector3)
Declaration
public BoundingBox GetIncluded(Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
|
Returns
Include(BoundingBox)
Declaration
public BoundingBox Include(BoundingBox box)
Parameters
Returns
Include(ref BoundingBox)
return expanded aabb (aabb include aabb)
Declaration
public BoundingBox Include(ref BoundingBox box)
Parameters
Returns
Include(ref BoundingFrustum)
Declaration
public BoundingBox Include(ref BoundingFrustum frustum)
Parameters
Returns
Include(BoundingSphere)
Declaration
public BoundingBox Include(BoundingSphere sphere)
Parameters
Returns
Include(ref BoundingSphere)
Declaration
public BoundingBox Include(ref BoundingSphere sphere)
Parameters
Returns
Include(ref Line)
Declaration
public void Include(ref Line line)
Parameters
| Type |
Name |
Description |
| Line |
line |
|
Include(Vector3)
Declaration
public BoundingBox Include(Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
|
Returns
Include(Vector3, Vector3, Vector3)
Declaration
public BoundingBox Include(Vector3 p0, Vector3 p1, Vector3 p2)
Parameters
Returns
Include(ref Vector3)
return expanded aabb (aabb include point)
Declaration
public BoundingBox Include(ref Vector3 point)
Parameters
| Type |
Name |
Description |
| Vector3 |
point |
|
Returns
Include(ref Vector3, ref Vector3, ref Vector3)
Declaration
public BoundingBox Include(ref Vector3 p0, ref Vector3 p1, ref Vector3 p2)
Parameters
Returns
Inflate(Single)
Declaration
public void Inflate(float size)
Parameters
| Type |
Name |
Description |
| System.Single |
size |
|
Inflate(Vector3)
Declaration
public void Inflate(Vector3 size)
Parameters
InflateToMinimum(Vector3)
Declaration
public void InflateToMinimum(Vector3 minimumSize)
Parameters
| Type |
Name |
Description |
| Vector3 |
minimumSize |
|
Intersect(BoundingBox)
Returns bounding box which is intersection of this and box
Result is invalid box when there's no intersection (Min > Max)
Declaration
public BoundingBox Intersect(BoundingBox box)
Parameters
Returns
Intersects(BoundingBox)
Checks whether the current BoundingBox intersects another BoundingBox.
Declaration
public bool Intersects(BoundingBox box)
Parameters
| Type |
Name |
Description |
| BoundingBox |
box |
The BoundingBox to check for intersection with.
|
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(ref BoundingBox)
Declaration
public bool Intersects(ref BoundingBox box)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(ref BoundingBox, out Boolean)
Checks whether the current BoundingBox intersects another BoundingBox.
Declaration
public void Intersects(ref BoundingBox box, out bool result)
Parameters
| Type |
Name |
Description |
| BoundingBox |
box |
The BoundingBox to check for intersection with.
|
| System.Boolean |
result |
[OutAttribute] true if the BoundingBox instances intersect; false otherwise.
|
Intersects(BoundingFrustum)
Checks whether the current BoundingBox intersects a BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustum frustum)
Parameters
| Type |
Name |
Description |
| BoundingFrustum |
frustum |
The BoundingFrustum to check for intersection with.
|
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(BoundingSphere)
Checks whether the current BoundingBox intersects a BoundingSphere.
Declaration
public bool Intersects(BoundingSphere sphere)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to check for intersection with.
|
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(ref BoundingSphere)
Declaration
public bool Intersects(ref BoundingSphere sphere)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(ref BoundingSphere, out Boolean)
Checks whether the current BoundingBox intersects a BoundingSphere.
Declaration
public void Intersects(ref BoundingSphere sphere, out bool result)
Parameters
| Type |
Name |
Description |
| BoundingSphere |
sphere |
The BoundingSphere to check for intersection with.
|
| System.Boolean |
result |
[OutAttribute] true if the BoundingBox and BoundingSphere intersect; false otherwise.
|
Intersects(ref BoundingSphereD)
Declaration
public bool Intersects(ref BoundingSphereD sphere)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(Line, out Single)
Declaration
public bool Intersects(Line line, out float distance)
Parameters
| Type |
Name |
Description |
| Line |
line |
|
| System.Single |
distance |
|
Returns
| Type |
Description |
| System.Boolean |
|
Intersects(Plane)
Checks whether the current BoundingBox intersects a Plane.
Declaration
public PlaneIntersectionType Intersects(Plane plane)
Parameters
| Type |
Name |
Description |
| Plane |
plane |
The Plane to check for intersection with.
|
Returns
Intersects(ref Plane, out PlaneIntersectionType)
Checks whether the current BoundingBox intersects a Plane.
Declaration
public void Intersects(ref Plane plane, out PlaneIntersectionType result)
Parameters
| Type |
Name |
Description |
| Plane |
plane |
The Plane to check for intersection with.
|
| PlaneIntersectionType |
result |
[OutAttribute] An enumeration indicating whether the BoundingBox intersects the Plane.
|
Intersects(Ray)
Checks whether the current BoundingBox intersects a Ray.
Declaration
public Nullable<float> Intersects(Ray ray)
Parameters
| Type |
Name |
Description |
| Ray |
ray |
The Ray to check for intersection with.
|
Returns
| Type |
Description |
| System.Nullable<System.Single> |
|
Intersects(ref Ray, out Nullable<Single>)
Checks whether the current BoundingBox intersects a Ray.
Declaration
public void Intersects(ref Ray ray, out Nullable<float> result)
Parameters
| Type |
Name |
Description |
| Ray |
ray |
The Ray to check for intersection with.
|
| System.Nullable<System.Single> |
result |
[OutAttribute] Distance at which the ray intersects the BoundingBox, or null if there is no intersection.
|
IntersectsTriangle(Vector3, Vector3, Vector3)
Declaration
public bool IntersectsTriangle(Vector3 v0, Vector3 v1, Vector3 v2)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
IntersectsTriangle(ref Vector3, ref Vector3, ref Vector3)
Declaration
public bool IntersectsTriangle(ref Vector3 v0, ref Vector3 v1, ref Vector3 v2)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
IsBetween(Single, Single, Single)
Declaration
public static bool IsBetween(float number, float min, float max)
Parameters
| Type |
Name |
Description |
| System.Single |
number |
|
| System.Single |
min |
|
| System.Single |
max |
|
Returns
| Type |
Description |
| System.Boolean |
|
ProjectedArea(Vector3)
Declaration
public float ProjectedArea(Vector3 viewDir)
Parameters
| Type |
Name |
Description |
| Vector3 |
viewDir |
|
Returns
| Type |
Description |
| System.Single |
|
Round()
Declaration
public BoundingBoxI Round()
Returns
Round(Int32)
Declaration
public BoundingBox Round(int decimals)
Parameters
| Type |
Name |
Description |
| System.Int32 |
decimals |
|
Returns
Scale(Vector3)
Declaration
public void Scale(Vector3 scale)
Parameters
| Type |
Name |
Description |
| Vector3 |
scale |
|
SurfaceArea()
Declaration
public float SurfaceArea()
Returns
| Type |
Description |
| System.Single |
|
ToString()
Returns a String that represents the current BoundingBox.
Declaration
public override string ToString()
Returns
| Type |
Description |
| System.String |
|
Declaration
public BoundingBox Transform(Matrix worldMatrix)
Parameters
| Type |
Name |
Description |
| Matrix |
worldMatrix |
|
Returns
Declaration
public BoundingBox Transform(ref Matrix m)
Parameters
| Type |
Name |
Description |
| Matrix |
m |
|
Returns
Declaration
public void Transform(ref Matrix m, ref BoundingBox bb)
Parameters
Declaration
public BoundingBoxD Transform(MatrixD worldMatrix)
Parameters
| Type |
Name |
Description |
| MatrixD |
worldMatrix |
|
Returns
Declaration
public BoundingBoxD Transform(ref MatrixD m)
Parameters
Returns
Declaration
public void Transform(ref MatrixD m, ref BoundingBoxD bb)
Parameters
Translate(Matrix)
Declaration
public BoundingBox Translate(Matrix worldMatrix)
Parameters
| Type |
Name |
Description |
| Matrix |
worldMatrix |
|
Returns
Translate(Vector3)
Declaration
public BoundingBox Translate(Vector3 vctTranlsation)
Parameters
| Type |
Name |
Description |
| Vector3 |
vctTranlsation |
|
Returns
Volume()
Declaration
Returns
| Type |
Description |
| System.Single |
|
Operators
Equality(BoundingBox, BoundingBox)
Determines whether two instances of BoundingBox are equal.
Declaration
public static bool operator ==(BoundingBox a, BoundingBox b)
Parameters
Returns
| Type |
Description |
| System.Boolean |
|
Inequality(BoundingBox, BoundingBox)
Determines whether two instances of BoundingBox are not equal.
Declaration
public static bool operator !=(BoundingBox a, BoundingBox b)
Parameters
| Type |
Name |
Description |
| BoundingBox |
a |
The object to the left of the inequality operator.
|
| BoundingBox |
b |
The object to the right of the inequality operator.
|
Returns
| Type |
Description |
| System.Boolean |
|