Class BoundingBox2D
Defines an axis-aligned box-shaped 2D volume.
Inheritance
System.Object
BoundingBox2D
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingBox2D : ValueType, IEquatable<BoundingBox2D>
Constructors
BoundingBox2D(Vector2D, Vector2D)
Creates an instance of BoundingBox2D.
Declaration
public BoundingBox2D(Vector2D min, Vector2D max)
Parameters
Type |
Name |
Description |
Vector2D |
min |
The minimum point the BoundingBox2D includes.
|
Vector2D |
max |
The maximum point the BoundingBox2D includes.
|
Fields
CornerCount
Specifies the total number of corners (8) in the BoundingBox2D.
Declaration
public const int CornerCount = 8
Field Value
Type |
Description |
System.Int32 |
|
Max
The maximum point the BoundingBox2D contains.
Declaration
Field Value
Min
The minimum point the BoundingBox2D contains.
Declaration
Field Value
Properties
Center
Declaration
public Vector2D Center { get; }
Property Value
Extents
Declaration
public Vector2D Extents { get; }
Property Value
HalfExtents
Declaration
public Vector2D HalfExtents { get; }
Property Value
Height
Declaration
public double Height { get; }
Property Value
Type |
Description |
System.Double |
|
Size
Declaration
public Vector2D Size { get; }
Property Value
Width
Declaration
public double Width { get; }
Property Value
Type |
Description |
System.Double |
|
Methods
Area()
Declaration
Returns
Type |
Description |
System.Double |
|
Contains(BoundingBox2D)
Tests whether the BoundingBox2D contains another BoundingBox2D.
Declaration
public ContainmentType Contains(BoundingBox2D box)
Parameters
Type |
Name |
Description |
BoundingBox2D |
box |
The BoundingBox2D to test for overlap.
|
Returns
Contains(ref BoundingBox2D, out ContainmentType)
Tests whether the BoundingBox2D contains a BoundingBox2D.
Declaration
public void Contains(ref BoundingBox2D box, out ContainmentType result)
Parameters
Type |
Name |
Description |
BoundingBox2D |
box |
The BoundingBox2D to test for overlap.
|
ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
Contains(Vector2D)
Tests whether the BoundingBox2D contains a point.
Declaration
public ContainmentType Contains(Vector2D point)
Parameters
Type |
Name |
Description |
Vector2D |
point |
The point to test for overlap.
|
Returns
Contains(ref Vector2D, out ContainmentType)
Tests whether the BoundingBox2D contains a point.
Declaration
public void Contains(ref Vector2D point, out ContainmentType result)
Parameters
Type |
Name |
Description |
Vector2D |
point |
The point to test for overlap.
|
ContainmentType |
result |
[OutAttribute] Enumeration indicating the extent of overlap.
|
CreateFromHalfExtent(Vector2D, Double)
Declaration
public static BoundingBox2D CreateFromHalfExtent(Vector2D center, double halfExtent)
Parameters
Type |
Name |
Description |
Vector2D |
center |
|
System.Double |
halfExtent |
|
Returns
CreateFromHalfExtent(Vector2D, Vector2D)
Declaration
public static BoundingBox2D CreateFromHalfExtent(Vector2D center, Vector2D halfExtent)
Parameters
Returns
CreateFromPoints(IEnumerable<Vector2D>)
Creates the smallest BoundingBox2D that will contain a group of points.
Declaration
public static BoundingBox2D CreateFromPoints(IEnumerable<Vector2D> points)
Parameters
Type |
Name |
Description |
System.Collections.Generic.IEnumerable<Vector2D> |
points |
A list of points the BoundingBox2D should contain.
|
Returns
CreateInvalid()
Declaration
public static BoundingBox2D CreateInvalid()
Returns
CreateMerged(BoundingBox2D, BoundingBox2D)
Creates the smallest BoundingBox2D that contains the two specified BoundingBox2D instances.
Declaration
public static BoundingBox2D CreateMerged(BoundingBox2D original, BoundingBox2D additional)
Parameters
Type |
Name |
Description |
BoundingBox2D |
original |
One of the BoundingBox2Ds to contain.
|
BoundingBox2D |
additional |
One of the BoundingBox2Ds to contain.
|
Returns
CreateMerged(ref BoundingBox2D, ref BoundingBox2D, out BoundingBox2D)
Creates the smallest BoundingBox2D that contains the two specified BoundingBox2D instances.
Declaration
public static void CreateMerged(ref BoundingBox2D original, ref BoundingBox2D additional, out BoundingBox2D result)
Parameters
Type |
Name |
Description |
BoundingBox2D |
original |
One of the BoundingBox2D instances to contain.
|
BoundingBox2D |
additional |
One of the BoundingBox2D instances to contain.
|
BoundingBox2D |
result |
[OutAttribute] The created BoundingBox2D.
|
Distance(Vector2D)
Declaration
public double Distance(Vector2D point)
Parameters
Returns
Type |
Description |
System.Double |
|
Equals(Object)
Determines whether two instances of BoundingBox2D are equal.
Declaration
public override bool Equals(object obj)
Parameters
Type |
Name |
Description |
System.Object |
obj |
The Object to compare with the current BoundingBox2D.
|
Returns
Type |
Description |
System.Boolean |
|
Equals(BoundingBox2D)
Determines whether two instances of BoundingBox2D are equal.
Declaration
public bool Equals(BoundingBox2D other)
Parameters
Type |
Name |
Description |
BoundingBox2D |
other |
The BoundingBox2D to compare with the current BoundingBox2D.
|
Returns
Type |
Description |
System.Boolean |
|
GetCorners()
Gets an array of points that make up the corners of the BoundingBox2D.
Declaration
public Vector2D[] GetCorners()
Returns
GetCorners(Vector2D[])
Gets the array of points that make up the corners of the BoundingBox2D.
Declaration
public void GetCorners(Vector2D[] corners)
Parameters
Type |
Name |
Description |
Vector2D[] |
corners |
An existing array of at least 8 Vector2D points where the corners of the BoundingBox2D are written.
|
GetCornersUnsafe(Vector2D*)
Gets the array of points that make up the corners of the BoundingBox2D.
Declaration
public void GetCornersUnsafe(Vector2D*corners)
Parameters
Type |
Name |
Description |
Vector2D* |
corners |
An existing array of at least 8 Vector2D points where the corners of the BoundingBox2D are written.
|
GetHashCode()
Gets the hash code for this instance.
Declaration
public override int GetHashCode()
Returns
Type |
Description |
System.Int32 |
|
GetIncluded(Vector2D)
Declaration
public BoundingBox2D GetIncluded(Vector2D point)
Parameters
Returns
Include(BoundingBox2D)
Declaration
public BoundingBox2D Include(BoundingBox2D box)
Parameters
Returns
Include(ref BoundingBox2D)
return expanded aabb (abb include point)
Declaration
public BoundingBox2D Include(ref BoundingBox2D box)
Parameters
Returns
Include(Vector2D)
Declaration
public BoundingBox2D Include(Vector2D point)
Parameters
Returns
Include(Vector2D, Vector2D, Vector2D)
Declaration
public BoundingBox2D Include(Vector2D p0, Vector2D p1, Vector2D p2)
Parameters
Returns
Include(ref Vector2D)
return expanded aabb (abb include point)
Declaration
public BoundingBox2D Include(ref Vector2D point)
Parameters
Returns
Include(ref Vector2D, ref Vector2D, ref Vector2D)
Declaration
public BoundingBox2D Include(ref Vector2D p0, ref Vector2D p1, ref Vector2D p2)
Parameters
Returns
Inflate(Double)
Declaration
public void Inflate(double size)
Parameters
Type |
Name |
Description |
System.Double |
size |
|
InflateToMinimum(Vector2D)
Declaration
public void InflateToMinimum(Vector2D minimumSize)
Parameters
Type |
Name |
Description |
Vector2D |
minimumSize |
|
Intersect(BoundingBox2D)
Returns bounding box which is intersection of this and box
It's called 'Prunik'
Result is invalid box when there's no intersection (Min > Max)
Declaration
public BoundingBox2D Intersect(BoundingBox2D box)
Parameters
Returns
Intersects(BoundingBox2D)
Checks whether the current BoundingBox2D intersects another BoundingBox2D.
Declaration
public bool Intersects(BoundingBox2D box)
Parameters
Type |
Name |
Description |
BoundingBox2D |
box |
The BoundingBox2D to check for intersection with.
|
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingBox2D)
Declaration
public bool Intersects(ref BoundingBox2D box)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Intersects(ref BoundingBox2D, out Boolean)
Checks whether the current BoundingBox2D intersects another BoundingBox2D.
Declaration
public void Intersects(ref BoundingBox2D box, out bool result)
Parameters
Type |
Name |
Description |
BoundingBox2D |
box |
The BoundingBox2D to check for intersection with.
|
System.Boolean |
result |
[OutAttribute] true if the BoundingBox2D instances intersect; false otherwise.
|
Perimeter()
Declaration
public double Perimeter()
Returns
Type |
Description |
System.Double |
|
Scale(Vector2D)
Declaration
public void Scale(Vector2D scale)
Parameters
ToString()
Returns a String that represents the current BoundingBox2D.
Declaration
public override string ToString()
Returns
Type |
Description |
System.String |
|
Translate(Vector2D)
Declaration
public BoundingBox2D Translate(Vector2D vctTranlsation)
Parameters
Type |
Name |
Description |
Vector2D |
vctTranlsation |
|
Returns
Operators
Equality(BoundingBox2D, BoundingBox2D)
Determines whether two instances of BoundingBox2D are equal.
Declaration
public static bool operator ==(BoundingBox2D a, BoundingBox2D b)
Parameters
Returns
Type |
Description |
System.Boolean |
|
Inequality(BoundingBox2D, BoundingBox2D)
Determines whether two instances of BoundingBox2D are not equal.
Declaration
public static bool operator !=(BoundingBox2D a, BoundingBox2D b)
Parameters
Type |
Name |
Description |
BoundingBox2D |
a |
The object to the left of the inequality operator.
|
BoundingBox2D |
b |
The object to the right of the inequality operator.
|
Returns
Type |
Description |
System.Boolean |
|