Class BoundingBoxD
Defines an axis-aligned box-shaped 3D volume.
Inheritance
System.Object
BoundingBoxD
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingBoxD : ValueType, IEquatable<BoundingBoxD>
Constructors
BoundingBoxD(Vector3D, Vector3D)
Creates an instance of BoundingBox.
Declaration
public BoundingBoxD(Vector3D min, Vector3D max)
Parameters
Type |
Name |
Description |
Vector3D |
min |
The minimum point the BoundingBox includes.
|
Vector3D |
max |
The maximum point the BoundingBox includes.
|
Fields
Comparer
Declaration
public static readonly BoundingBoxD.ComparerType Comparer
Field Value
Max
The maximum point the BoundingBox contains.
Declaration
Field Value
Min
The minimum point the BoundingBox contains.
Declaration
Field Value
NUMBER_OF_CORNERS
Number of corners of the BB
Declaration
public static readonly int NUMBER_OF_CORNERS
Field Value
Type |
Description |
System.Int32 |
|
Properties
Center
Declaration
public Vector3D Center { get; }
Property Value
Extents
Declaration
public Vector3D Extents { get; }
Property Value
HalfExtents
Declaration
public Vector3D HalfExtents { get; }
Property Value
Matrix
Matrix of AABB, respecting center and size
Declaration
public MatrixD Matrix { get; }
Property Value
Perimeter
return perimeter of edges
Declaration
public double Perimeter { get; }
Property Value
Type |
Description |
System.Double |
|
Size
Declaration
public Vector3D Size { get; }
Property Value
SurfaceArea
Declaration
public double SurfaceArea { get; }
Property Value
Type |
Description |
System.Double |
|
Valid
Declaration
public bool Valid { get; }
Property Value
Type |
Description |
System.Boolean |
|
Volume
Declaration
public double Volume { get; }
Property Value
Type |
Description |
System.Double |
|
Methods
AssertIsValid()
Declaration
public void AssertIsValid()
Centerize(Vector3D)
Declaration
public void Centerize(Vector3D center)
Parameters
Contains(BoundingBoxD)
Tests whether the BoundingBox contains another BoundingBox.
Declaration
public ContainmentType Contains(BoundingBoxD box)
Parameters
Type |
Name |
Description |
BoundingBoxD |
box |
The BoundingBox to test for overlap.
|
Returns
Contains(ref BoundingBoxD, out ContainmentType)
Tests whether the BoundingBox contains a BoundingBox.
Declaration
public void Contains(ref BoundingBoxD box, out ContainmentType result)
Parameters
Type |
Name |
Description |
BoundingBoxD |
box |
The BoundingBox to test for overlap.
|
ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(BoundingFrustumD)
Tests whether the BoundingBox contains a BoundingFrustum.
Declaration
public ContainmentType Contains(BoundingFrustumD frustum)
Parameters
Type |
Name |
Description |
BoundingFrustumD |
frustum |
The BoundingFrustum to test for overlap.
|
Returns
Contains(BoundingSphereD)
Tests whether the BoundingBox contains a BoundingSphere.
Declaration
public ContainmentType Contains(BoundingSphereD sphere)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to test for overlap.
|
Returns
Contains(ref BoundingSphereD, out ContainmentType)
Tests whether the BoundingBox contains a BoundingSphere.
Declaration
public void Contains(ref BoundingSphereD sphere, out ContainmentType result)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to test for overlap.
|
ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(Vector3D)
Tests whether the BoundingBox contains a point.
Declaration
public ContainmentType Contains(Vector3D point)
Parameters
Type |
Name |
Description |
Vector3D |
point |
The point to test for overlap.
|
Returns
Contains(ref Vector3D, out ContainmentType)
Tests whether the BoundingBox contains a point.
Declaration
public void Contains(ref Vector3D point, out ContainmentType result)
Parameters
Type |
Name |
Description |
Vector3D |
point |
The point to test for overlap.
|
ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
CreateFromPoints(IEnumerable<Vector3D>)
Creates the smallest BoundingBox that will contain a group of points.
Declaration
public static BoundingBoxD CreateFromPoints(IEnumerable<Vector3D> points)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<Vector3D> |
points |
A list of points the BoundingBox should contain.
|
Returns
CreateFromSphere(BoundingSphereD)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.
Declaration
public static BoundingBoxD CreateFromSphere(BoundingSphereD sphere)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to contain.
|
Returns
CreateFromSphere(ref BoundingSphereD, out BoundingBoxD)
Creates the smallest BoundingBox that will contain the specified BoundingSphere.
Declaration
public static void CreateFromSphere(ref BoundingSphereD sphere, out BoundingBoxD result)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to contain.
|
BoundingBoxD |
result |
[OutAttribute] The created BoundingBox.
|
CreateInvalid()
Declaration
public static BoundingBoxD CreateInvalid()
Returns
CreateMerged(BoundingBoxD, BoundingBoxD)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
Declaration
public static BoundingBoxD CreateMerged(BoundingBoxD original, BoundingBoxD additional)
Parameters
Type |
Name |
Description |
BoundingBoxD |
original |
One of the BoundingBoxs to contain.
|
BoundingBoxD |
additional |
One of the BoundingBoxs to contain.
|
Returns
CreateMerged(ref BoundingBoxD, ref BoundingBoxD, out BoundingBoxD)
Creates the smallest BoundingBox that contains the two specified BoundingBox instances.
Declaration
public static void CreateMerged(ref BoundingBoxD original, ref BoundingBoxD additional, out BoundingBoxD result)
Parameters
Type |
Name |
Description |
BoundingBoxD |
original |
One of the BoundingBox instances to contain.
|
BoundingBoxD |
additional |
One of the BoundingBox instances to contain.
|
BoundingBoxD |
result |
[OutAttribute] The created BoundingBox.
|
Distance(ref BoundingBoxD)
Declaration
public double Distance(ref BoundingBoxD other)
Parameters
Returns
Type |
Description |
System.Double |
|
Distance(Vector3D)
Declaration
public double Distance(Vector3D point)
Parameters
Returns
Type |
Description |
System.Double |
|
DistanceSquared(ref BoundingBoxD)
Declaration
public double DistanceSquared(ref BoundingBoxD other)
Parameters
Returns
Type |
Description |
System.Double |
|
DistanceSquared(Vector3D)
Declaration
public double DistanceSquared(Vector3D point)
Parameters
Returns
Type |
Description |
System.Double |
|
DistanceSquared(ref Vector3D)
Declaration
public double DistanceSquared(ref Vector3D point)
Parameters
Returns
Type |
Description |
System.Double |
|
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(BoundingBoxD)
Determines whether two instances of BoundingBox are equal.
Declaration
public bool Equals(BoundingBoxD other)
Parameters
Type |
Name |
Description |
BoundingBoxD |
other |
The BoundingBox to compare with the current BoundingBox.
|
Returns
Type |
Description |
System.Boolean |
|
Equals(BoundingBoxD, Double)
Declaration
public bool Equals(BoundingBoxD other, double epsilon)
Parameters
Type |
Name |
Description |
BoundingBoxD |
other |
|
System.Double |
epsilon |
|
Returns
Type |
Description |
System.Boolean |
|
GetCorner(Int32)
Gets corner of the BB by index
Declaration
public Vector3D GetCorner(int index)
Parameters
Type |
Name |
Description |
System.Int32 |
index |
index of the corner
|
Returns
Type |
Description |
Vector3D |
corner position
|
GetCorners()
Gets an array of points that make up the corners of the BoundingBox. ALLOCATION!
Declaration
public Vector3D[] GetCorners()
Returns
GetCorners(Vector3D[])
Gets the array of points that make up the corners of the BoundingBox.
Declaration
public void GetCorners(Vector3D[] corners)
Parameters
Type |
Name |
Description |
Vector3D[] |
corners |
An existing array of at least 8 Vector3 points where the corners of the BoundingBox are written.
|
GetCornersUnsafe(Vector3D*)
Gets the array of points that make up the corners of the BoundingBox.
Declaration
public void GetCornersUnsafe(Vector3D*corners)
Parameters
Type |
Name |
Description |
Vector3D* |
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 |
|
GetInflated(Double)
Declaration
public BoundingBoxD GetInflated(double size)
Parameters
Type |
Name |
Description |
System.Double |
size |
|
Returns
GetInflated(Vector3)
Declaration
public BoundingBoxD GetInflated(Vector3 size)
Parameters
Returns
GetInflated(Vector3D)
Declaration
public BoundingBoxD GetInflated(Vector3D size)
Parameters
Returns
Include(BoundingBoxD)
Declaration
public BoundingBoxD Include(BoundingBoxD box)
Parameters
Returns
Include(ref BoundingBoxD)
return expanded aabb (aabb include aabb)
Declaration
public BoundingBoxD Include(ref BoundingBoxD box)
Parameters
Returns
Include(ref BoundingFrustumD)
Declaration
public BoundingBoxD Include(ref BoundingFrustumD frustum)
Parameters
Returns
Include(BoundingSphereD)
Declaration
public BoundingBoxD Include(BoundingSphereD sphere)
Parameters
Returns
Include(ref BoundingSphereD)
Declaration
public BoundingBoxD Include(ref BoundingSphereD sphere)
Parameters
Returns
Include(ref LineD)
Declaration
public void Include(ref LineD line)
Parameters
Type |
Name |
Description |
LineD |
line |
|
Include(Vector3D)
Declaration
public BoundingBoxD Include(Vector3D point)
Parameters
Returns
Include(Vector3D, Vector3D, Vector3D)
Declaration
public BoundingBoxD Include(Vector3D p0, Vector3D p1, Vector3D p2)
Parameters
Returns
Include(ref Vector3D)
return expanded aabb (aabb include point)
Declaration
public BoundingBoxD Include(ref Vector3D point)
Parameters
Returns
Include(ref Vector3D, ref Vector3D, ref Vector3D)
Declaration
public BoundingBoxD Include(ref Vector3D p0, ref Vector3D p1, ref Vector3D p2)
Parameters
Returns
Inflate(Double)
Declaration
public BoundingBoxD Inflate(double size)
Parameters
Type |
Name |
Description |
System.Double |
size |
|
Returns
Inflate(Vector3D)
Declaration
public BoundingBoxD Inflate(Vector3D size)
Parameters
Returns
InflateToMinimum(Double)
Declaration
public void InflateToMinimum(double minimumSize)
Parameters
Type |
Name |
Description |
System.Double |
minimumSize |
|
InflateToMinimum(Vector3D)
Declaration
public void InflateToMinimum(Vector3D minimumSize)
Parameters
Type |
Name |
Description |
Vector3D |
minimumSize |
|
Intersect(BoundingBoxD)
Returns bounding box which is intersection of this and box
Result is invalid box when there's no intersection (Min > Max)
Declaration
public BoundingBoxD Intersect(BoundingBoxD box)
Parameters
Returns
Intersect(ref LineD, out Double, out Double)
Declaration
public bool Intersect(ref LineD line, out double t1, out double t2)
Parameters
Type |
Name |
Description |
LineD |
line |
|
System.Double |
t1 |
|
System.Double |
t2 |
|
Returns
Type |
Description |
System.Boolean |
|
Intersect(ref LineD, out LineD)
Declaration
public bool Intersect(ref LineD line, out LineD intersectedLine)
Parameters
Type |
Name |
Description |
LineD |
line |
|
LineD |
intersectedLine |
|
Returns
Type |
Description |
System.Boolean |
|
Intersect(ref RayD, out Double, out Double)
Declaration
public bool Intersect(ref RayD ray, out double tmin, out double tmax)
Parameters
Type |
Name |
Description |
RayD |
ray |
|
System.Double |
tmin |
|
System.Double |
tmax |
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingBox, out Boolean)
Declaration
public void Intersects(ref BoundingBox box, out bool result)
Parameters
Type |
Name |
Description |
BoundingBox |
box |
|
System.Boolean |
result |
|
Intersects(BoundingBoxD)
Checks whether the current BoundingBox intersects another BoundingBox.
Declaration
public bool Intersects(BoundingBoxD box)
Parameters
Type |
Name |
Description |
BoundingBoxD |
box |
The BoundingBox to check for intersection with.
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingBoxD)
Declaration
public bool Intersects(ref BoundingBoxD box)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingBoxD, out Boolean)
Checks whether the current BoundingBox intersects another BoundingBox.
Declaration
public void Intersects(ref BoundingBoxD box, out bool result)
Parameters
Type |
Name |
Description |
BoundingBoxD |
box |
The BoundingBox to check for intersection with.
|
System.Boolean |
result |
[OutAttribute] true if the BoundingBox instances intersect; false otherwise.
|
Intersects(BoundingFrustumD)
Checks whether the current BoundingBox intersects a BoundingFrustum.
Declaration
public bool Intersects(BoundingFrustumD frustum)
Parameters
Type |
Name |
Description |
BoundingFrustumD |
frustum |
The BoundingFrustum to check for intersection with.
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(BoundingSphereD)
Checks whether the current BoundingBox intersects a BoundingSphere.
Declaration
public bool Intersects(BoundingSphereD sphere)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to check for intersection with.
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingSphereD)
Declaration
public bool Intersects(ref BoundingSphereD sphere)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingSphereD, out Boolean)
Checks whether the current BoundingBox intersects a BoundingSphere.
Declaration
public void Intersects(ref BoundingSphereD sphere, out bool result)
Parameters
Type |
Name |
Description |
BoundingSphereD |
sphere |
The BoundingSphere to check for intersection with.
|
System.Boolean |
result |
[OutAttribute] true if the BoundingBox and BoundingSphere intersect; false otherwise.
|
Intersects(ref LineD)
Declaration
public bool Intersects(ref LineD line)
Parameters
Type |
Name |
Description |
LineD |
line |
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref LineD, out Double)
Declaration
public bool Intersects(ref LineD line, out double distance)
Parameters
Type |
Name |
Description |
LineD |
line |
|
System.Double |
distance |
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(PlaneD)
Checks whether the current BoundingBox intersects a Plane.
Declaration
public PlaneIntersectionType Intersects(PlaneD plane)
Parameters
Type |
Name |
Description |
PlaneD |
plane |
The Plane to check for intersection with.
|
Returns
Intersects(ref PlaneD, out PlaneIntersectionType)
Checks whether the current BoundingBox intersects a Plane.
Declaration
public void Intersects(ref PlaneD plane, out PlaneIntersectionType result)
Parameters
Type |
Name |
Description |
PlaneD |
plane |
The Plane to check for intersection with.
|
PlaneIntersectionType |
result |
[OutAttribute] An enumeration indicating whether the BoundingBox intersects the Plane.
|
Intersects(Ray)
Declaration
public Nullable<double> Intersects(Ray ray)
Parameters
Type |
Name |
Description |
Ray |
ray |
|
Returns
Type |
Description |
System.Nullable<System.Double> |
|
Intersects(RayD)
Checks whether the current BoundingBox intersects a Ray.
Declaration
public Nullable<double> Intersects(RayD ray)
Parameters
Type |
Name |
Description |
RayD |
ray |
The Ray to check for intersection with.
|
Returns
Type |
Description |
System.Nullable<System.Double> |
|
Intersects(ref RayD, out Nullable<Double>)
Checks whether the current BoundingBox intersects a Ray.
Declaration
public void Intersects(ref RayD ray, out Nullable<double> result)
Parameters
Type |
Name |
Description |
RayD |
ray |
The Ray to check for intersection with.
|
System.Nullable<System.Double> |
result |
[OutAttribute] Distance at which the ray intersects the BoundingBox, or null if there is no intersection.
|
IntersectsTriangle(Vector3D, Vector3D, Vector3D)
Declaration
public bool IntersectsTriangle(Vector3D v0, Vector3D v1, Vector3D v2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
IntersectsTriangle(ref Vector3D, ref Vector3D, ref Vector3D)
Declaration
public bool IntersectsTriangle(ref Vector3D v0, ref Vector3D v1, ref Vector3D v2)
Parameters
Returns
Type |
Description |
System.Boolean |
|
ProjectedArea(Vector3D)
Declaration
public double ProjectedArea(Vector3D viewDir)
Parameters
Returns
Type |
Description |
System.Double |
|
Round()
Declaration
public BoundingBoxI Round()
Returns
Round(Int32)
Declaration
public BoundingBoxD Round(int decimals)
Parameters
Type |
Name |
Description |
System.Int32 |
decimals |
|
Returns
ToString()
Returns a String that represents the current BoundingBox.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Transform this AABB by matrix. Matrix has to be only rotation and translation.
Declaration
public BoundingBoxD TransformFast(MatrixD m)
Parameters
Type |
Name |
Description |
MatrixD |
m |
transformation matrix
|
Returns
Transform this AABB by matrix. Matrix has to be only rotation and translation.
Declaration
public BoundingBoxD TransformFast(ref MatrixD m)
Parameters
Type |
Name |
Description |
MatrixD |
m |
transformation matrix
|
Returns
Transform this AABB by matrix. Matrix has to be only rotation and translation.
Declaration
public void TransformFast(ref MatrixD m, ref BoundingBoxD bb)
Parameters
Transform this AABB by matrix.
Declaration
public BoundingBoxD TransformSlow(MatrixD m)
Parameters
Type |
Name |
Description |
MatrixD |
m |
transformation matrix
|
Returns
Transform this AABB by matrix.
Declaration
public BoundingBoxD TransformSlow(ref MatrixD worldMatrix)
Parameters
Type |
Name |
Description |
MatrixD |
worldMatrix |
transformation matrix
|
Returns
Translate(MatrixD)
Declaration
public BoundingBoxD Translate(MatrixD worldMatrix)
Parameters
Type |
Name |
Description |
MatrixD |
worldMatrix |
|
Returns
Translate(Vector3D)
Declaration
public BoundingBoxD Translate(Vector3D vctTranlsation)
Parameters
Type |
Name |
Description |
Vector3D |
vctTranlsation |
|
Returns
Operators
Addition(BoundingBoxD, Vector3D)
Declaration
public static BoundingBoxD operator +(BoundingBoxD a, Vector3D b)
Parameters
Returns
Equality(BoundingBoxD, BoundingBoxD)
Determines whether two instances of BoundingBox are equal.
Declaration
public static bool operator ==(BoundingBoxD a, BoundingBoxD b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Explicit(BoundingBoxD to BoundingBox)
Declaration
public static explicit operator BoundingBox(BoundingBoxD b)
Parameters
Returns
Implicit(BoundingBox to BoundingBoxD)
Declaration
public static implicit operator BoundingBoxD(BoundingBox box)
Parameters
Returns
Implicit(BoundingBoxI to BoundingBoxD)
Declaration
public static implicit operator BoundingBoxD(BoundingBoxI box)
Parameters
Returns
Inequality(BoundingBoxD, BoundingBoxD)
Determines whether two instances of BoundingBox are not equal.
Declaration
public static bool operator !=(BoundingBoxD a, BoundingBoxD b)
Parameters
Type |
Name |
Description |
BoundingBoxD |
a |
The object to the left of the inequality operator.
|
BoundingBoxD |
b |
The object to the right of the inequality operator.
|
Returns
Type |
Description |
System.Boolean |
|