Show / Hide Table of Contents

Class BoundingBox2

Defines an axis-aligned box-shaped 3D volume.

Inheritance
System.Object
BoundingBox2
Namespace: VRageMath
Assembly: VRage.Math.dll
Syntax
public sealed class BoundingBox2 : ValueType, IEquatable<BoundingBox2>

Constructors

BoundingBox2(Vector2, Vector2)

Creates an instance of BoundingBox2.

Declaration
public BoundingBox2(Vector2 min, Vector2 max)
Parameters
Type Name Description
Vector2 min

The minimum point the BoundingBox2 includes.

Vector2 max

The maximum point the BoundingBox2 includes.

Fields

Max

The maximum point the BoundingBox2 contains.

Declaration
public Vector2 Max
Field Value
Type Description
Vector2

Min

The minimum point the BoundingBox2 contains.

Declaration
public Vector2 Min
Field Value
Type Description
Vector2

Properties

Center

Calculates center

Declaration
public Vector2 Center { get; }
Property Value
Type Description
Vector2

Extents

Declaration
public Vector2 Extents { get; }
Property Value
Type Description
Vector2

HalfExtents

Declaration
public Vector2 HalfExtents { get; }
Property Value
Type Description
Vector2

Height

Declaration
public float Height { get; }
Property Value
Type Description
System.Single

Size

Size

Declaration
public Vector2 Size { get; }
Property Value
Type Description
Vector2

Width

Declaration
public float Width { get; }
Property Value
Type Description
System.Single

Methods

Area()

Declaration
public float Area()
Returns
Type Description
System.Single

Contains(BoundingBox2)

Tests whether the BoundingBox2 contains another BoundingBox2.

Declaration
public ContainmentType Contains(BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box

The BoundingBox2 to test for overlap.

Returns
Type Description
ContainmentType

Contains(ref BoundingBox2, out ContainmentType)

Tests whether the BoundingBox2 contains a BoundingBox2.

Declaration
public void Contains(ref BoundingBox2 box, out ContainmentType result)
Parameters
Type Name Description
BoundingBox2 box

The BoundingBox2 to test for overlap.

ContainmentType result

[OutAttribute] Enumeration indicating the extent of overlap.

Contains(Vector2)

Tests whether the BoundingBox2 contains a point.

Declaration
public ContainmentType Contains(Vector2 point)
Parameters
Type Name Description
Vector2 point

The point to test for overlap.

Returns
Type Description
ContainmentType

Contains(ref Vector2, out ContainmentType)

Tests whether the BoundingBox2 contains a point.

Declaration
public void Contains(ref Vector2 point, out ContainmentType result)
Parameters
Type Name Description
Vector2 point

The point to test for overlap.

ContainmentType result

[OutAttribute] Enumeration indicating the extent of overlap.

CreateFromHalfExtent(Vector2, Single)

Declaration
public static BoundingBox2 CreateFromHalfExtent(Vector2 center, float halfExtent)
Parameters
Type Name Description
Vector2 center
System.Single halfExtent
Returns
Type Description
BoundingBox2

CreateFromHalfExtent(Vector2, Vector2)

Declaration
public static BoundingBox2 CreateFromHalfExtent(Vector2 center, Vector2 halfExtent)
Parameters
Type Name Description
Vector2 center
Vector2 halfExtent
Returns
Type Description
BoundingBox2

CreateFromPoints(IEnumerable<Vector2>)

Creates the smallest BoundingBox2 that will contain a group of points.

Declaration
public static BoundingBox2 CreateFromPoints(IEnumerable<Vector2> points)
Parameters
Type Name Description
System.Collections.Generic.IEnumerable<Vector2> points

A list of points the BoundingBox2 should contain.

Returns
Type Description
BoundingBox2

CreateInvalid()

Declaration
public static BoundingBox2 CreateInvalid()
Returns
Type Description
BoundingBox2

CreateMerged(BoundingBox2, BoundingBox2)

Creates the smallest BoundingBox2 that contains the two specified BoundingBox2 instances.

Declaration
public static BoundingBox2 CreateMerged(BoundingBox2 original, BoundingBox2 additional)
Parameters
Type Name Description
BoundingBox2 original

One of the BoundingBox2s to contain.

BoundingBox2 additional

One of the BoundingBox2s to contain.

Returns
Type Description
BoundingBox2

CreateMerged(ref BoundingBox2, ref BoundingBox2, out BoundingBox2)

Creates the smallest BoundingBox2 that contains the two specified BoundingBox2 instances.

Declaration
public static void CreateMerged(ref BoundingBox2 original, ref BoundingBox2 additional, out BoundingBox2 result)
Parameters
Type Name Description
BoundingBox2 original

One of the BoundingBox2 instances to contain.

BoundingBox2 additional

One of the BoundingBox2 instances to contain.

BoundingBox2 result

[OutAttribute] The created BoundingBox2.

Distance(Vector2)

Declaration
public float Distance(Vector2 point)
Parameters
Type Name Description
Vector2 point
Returns
Type Description
System.Single

Equals(Object)

Determines whether two instances of BoundingBox2 are equal.

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
System.Object obj

The Object to compare with the current BoundingBox2.

Returns
Type Description
System.Boolean

Equals(BoundingBox2)

Determines whether two instances of BoundingBox2 are equal.

Declaration
public bool Equals(BoundingBox2 other)
Parameters
Type Name Description
BoundingBox2 other

The BoundingBox2 to compare with the current BoundingBox2.

Returns
Type Description
System.Boolean

GetCorners()

Gets an array of points that make up the corners of the BoundingBox2.

Declaration
public Vector2[] GetCorners()
Returns
Type Description
Vector2[]

GetCorners(Vector2[])

Gets the array of points that make up the corners of the BoundingBox2.

Declaration
public void GetCorners(Vector2[] corners)
Parameters
Type Name Description
Vector2[] corners

An existing array of at least 8 Vector2 points where the corners of the BoundingBox2 are written.

GetCornersUnsafe(Vector2*)

Gets the array of points that make up the corners of the BoundingBox2.

Declaration
public void GetCornersUnsafe(Vector2*corners)
Parameters
Type Name Description
Vector2* corners

An existing array of at least 8 Vector2 points where the corners of the BoundingBox2 are written.

GetHashCode()

Gets the hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32

GetIncluded(Vector2)

Declaration
public BoundingBox2 GetIncluded(Vector2 point)
Parameters
Type Name Description
Vector2 point
Returns
Type Description
BoundingBox2

Include(BoundingBox2)

Declaration
public BoundingBox2 Include(BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box
Returns
Type Description
BoundingBox2

Include(ref BoundingBox2)

return expanded aabb (abb include point)

Declaration
public BoundingBox2 Include(ref BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box
Returns
Type Description
BoundingBox2

Include(Vector2)

Declaration
public BoundingBox2 Include(Vector2 point)
Parameters
Type Name Description
Vector2 point
Returns
Type Description
BoundingBox2

Include(Vector2, Vector2, Vector2)

Declaration
public BoundingBox2 Include(Vector2 p0, Vector2 p1, Vector2 p2)
Parameters
Type Name Description
Vector2 p0
Vector2 p1
Vector2 p2
Returns
Type Description
BoundingBox2

Include(ref Vector2)

return expanded aabb (abb include point)

Declaration
public BoundingBox2 Include(ref Vector2 point)
Parameters
Type Name Description
Vector2 point
Returns
Type Description
BoundingBox2

Include(ref Vector2, ref Vector2, ref Vector2)

Declaration
public BoundingBox2 Include(ref Vector2 p0, ref Vector2 p1, ref Vector2 p2)
Parameters
Type Name Description
Vector2 p0
Vector2 p1
Vector2 p2
Returns
Type Description
BoundingBox2

Inflate(Single)

Declaration
public void Inflate(float size)
Parameters
Type Name Description
System.Single size

InflateToMinimum(Vector2)

Declaration
public void InflateToMinimum(Vector2 minimumSize)
Parameters
Type Name Description
Vector2 minimumSize

Intersect(BoundingBox2)

Returns bounding box which is intersection of this and box
Result is invalid box when there's no intersection (Min > Max)

Declaration
public BoundingBox2 Intersect(BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box
Returns
Type Description
BoundingBox2

Intersects(BoundingBox2)

Checks whether the current BoundingBox2 intersects another BoundingBox2.

Declaration
public bool Intersects(BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box

The BoundingBox2 to check for intersection with.

Returns
Type Description
System.Boolean

Intersects(ref BoundingBox2)

Declaration
public bool Intersects(ref BoundingBox2 box)
Parameters
Type Name Description
BoundingBox2 box
Returns
Type Description
System.Boolean

Intersects(ref BoundingBox2, out Boolean)

Checks whether the current BoundingBox2 intersects another BoundingBox2.

Declaration
public void Intersects(ref BoundingBox2 box, out bool result)
Parameters
Type Name Description
BoundingBox2 box

The BoundingBox2 to check for intersection with.

System.Boolean result

[OutAttribute] true if the BoundingBox2 instances intersect; false otherwise.

Perimeter()

Declaration
public float Perimeter()
Returns
Type Description
System.Single

Scale(Vector2)

Declaration
public void Scale(Vector2 scale)
Parameters
Type Name Description
Vector2 scale

ToString()

Returns a String that represents the current BoundingBox2.

Declaration
public override string ToString()
Returns
Type Description
System.String

Translate(Vector2)

Translate

Declaration
public BoundingBox2 Translate(Vector2 vctTranlsation)
Parameters
Type Name Description
Vector2 vctTranlsation
Returns
Type Description
BoundingBox2

Operators

Equality(BoundingBox2, BoundingBox2)

Determines whether two instances of BoundingBox2 are equal.

Declaration
public static bool operator ==(BoundingBox2 a, BoundingBox2 b)
Parameters
Type Name Description
BoundingBox2 a

BoundingBox2 to compare.

BoundingBox2 b

BoundingBox2 to compare.

Returns
Type Description
System.Boolean

Inequality(BoundingBox2, BoundingBox2)

Determines whether two instances of BoundingBox2 are not equal.

Declaration
public static bool operator !=(BoundingBox2 a, BoundingBox2 b)
Parameters
Type Name Description
BoundingBox2 a

The object to the left of the inequality operator.

BoundingBox2 b

The object to the right of the inequality operator.

Returns
Type Description
System.Boolean
☀
☾
In This Article
Back to top
Generated by DocFX
☀
☾