Show / Hide Table of Contents

Class BoundingBox2D

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

Inheritance
System.Object
BoundingBox2D
Namespace: VRageMath
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
public Vector2D Max
Field Value
Type Description
Vector2D

Min

The minimum point the BoundingBox2D contains.

Declaration
public Vector2D Min
Field Value
Type Description
Vector2D

Properties

Center

Calculates center

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

Extents

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

HalfExtents

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

Height

Declaration
public double Height { get; }
Property Value
Type Description
System.Double

Size

Size

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

Width

Declaration
public double Width { get; }
Property Value
Type Description
System.Double

Methods

Area()

Declaration
public double Area()
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
Type Description
ContainmentType

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
Type Description
ContainmentType

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
Type Description
BoundingBox2D

CreateFromHalfExtent(Vector2D, Vector2D)

Declaration
public static BoundingBox2D CreateFromHalfExtent(Vector2D center, Vector2D halfExtent)
Parameters
Type Name Description
Vector2D center
Vector2D halfExtent
Returns
Type Description
BoundingBox2D

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
Type Description
BoundingBox2D

CreateInvalid()

Declaration
public static BoundingBox2D CreateInvalid()
Returns
Type Description
BoundingBox2D

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
Type Description
BoundingBox2D

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
Type Name Description
Vector2D point
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
Type Description
Vector2D[]

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
Type Name Description
Vector2D point
Returns
Type Description
BoundingBox2D

Include(BoundingBox2D)

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

Include(ref BoundingBox2D)

return expanded aabb (abb include point)

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

Include(Vector2D)

Declaration
public BoundingBox2D Include(Vector2D point)
Parameters
Type Name Description
Vector2D point
Returns
Type Description
BoundingBox2D

Include(Vector2D, Vector2D, Vector2D)

Declaration
public BoundingBox2D Include(Vector2D p0, Vector2D p1, Vector2D p2)
Parameters
Type Name Description
Vector2D p0
Vector2D p1
Vector2D p2
Returns
Type Description
BoundingBox2D

Include(ref Vector2D)

return expanded aabb (abb include point)

Declaration
public BoundingBox2D Include(ref Vector2D point)
Parameters
Type Name Description
Vector2D point
Returns
Type Description
BoundingBox2D

Include(ref Vector2D, ref Vector2D, ref Vector2D)

Declaration
public BoundingBox2D Include(ref Vector2D p0, ref Vector2D p1, ref Vector2D p2)
Parameters
Type Name Description
Vector2D p0
Vector2D p1
Vector2D p2
Returns
Type Description
BoundingBox2D

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
Type Name Description
BoundingBox2D box
Returns
Type Description
BoundingBox2D

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
Type Name Description
BoundingBox2D box
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
Type Name Description
Vector2D scale

ToString()

Returns a String that represents the current BoundingBox2D.

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

Translate(Vector2D)

Translate

Declaration
public BoundingBox2D Translate(Vector2D vctTranlsation)
Parameters
Type Name Description
Vector2D vctTranlsation
Returns
Type Description
BoundingBox2D

Operators

Equality(BoundingBox2D, BoundingBox2D)

Determines whether two instances of BoundingBox2D are equal.

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

BoundingBox2D to compare.

BoundingBox2D b

BoundingBox2D to compare.

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
☀
☾
In This Article
  • Constructors
    • BoundingBox2D(Vector2D, Vector2D)
  • Fields
    • CornerCount
    • Max
    • Min
  • Properties
    • Center
    • Extents
    • HalfExtents
    • Height
    • Size
    • Width
  • Methods
    • Area()
    • Contains(BoundingBox2D)
    • Contains(ref BoundingBox2D, out ContainmentType)
    • Contains(Vector2D)
    • Contains(ref Vector2D, out ContainmentType)
    • CreateFromHalfExtent(Vector2D, Double)
    • CreateFromHalfExtent(Vector2D, Vector2D)
    • CreateFromPoints(IEnumerable<Vector2D>)
    • CreateInvalid()
    • CreateMerged(BoundingBox2D, BoundingBox2D)
    • CreateMerged(ref BoundingBox2D, ref BoundingBox2D, out BoundingBox2D)
    • Distance(Vector2D)
    • Equals(Object)
    • Equals(BoundingBox2D)
    • GetCorners()
    • GetCorners(Vector2D[])
    • GetCornersUnsafe(Vector2D*)
    • GetHashCode()
    • GetIncluded(Vector2D)
    • Include(BoundingBox2D)
    • Include(ref BoundingBox2D)
    • Include(Vector2D)
    • Include(Vector2D, Vector2D, Vector2D)
    • Include(ref Vector2D)
    • Include(ref Vector2D, ref Vector2D, ref Vector2D)
    • Inflate(Double)
    • InflateToMinimum(Vector2D)
    • Intersect(BoundingBox2D)
    • Intersects(BoundingBox2D)
    • Intersects(ref BoundingBox2D)
    • Intersects(ref BoundingBox2D, out Boolean)
    • Perimeter()
    • Scale(Vector2D)
    • ToString()
    • Translate(Vector2D)
  • Operators
    • Equality(BoundingBox2D, BoundingBox2D)
    • Inequality(BoundingBox2D, BoundingBox2D)
Back to top
Generated by DocFX
☀
☾