Table of Contents

Struct BoundingBox

Namespace
Stride.Core.Mathematics
Assembly
Stride.Core.Mathematics.dll

Represents an axis-aligned bounding box in three dimensional space.

[DataContract]
public struct BoundingBox : IEquatable<BoundingBox>, IFormattable, IIntersectableWithRay, IIntersectableWithPlane
Implements

Constructors

BoundingBox(Vector3, Vector3)

Initializes a new instance of the BoundingBox struct.

public BoundingBox(Vector3 minimum, Vector3 maximum)

Parameters

minimum Vector3

The minimum vertex of the bounding box.

maximum Vector3

The maximum vertex of the bounding box.

Fields

Empty

A BoundingBox which represents an empty space.

public static readonly BoundingBox Empty

Field Value

BoundingBox

Maximum

The maximum point of the box.

public Vector3 Maximum

Field Value

Vector3

Minimum

The minimum point of the box.

public Vector3 Minimum

Field Value

Vector3

Properties

Center

Gets the center of this bouding box.

public Vector3 Center { get; }

Property Value

Vector3

Extent

Gets the extent of this bouding box.

public Vector3 Extent { get; }

Property Value

Vector3

Methods

Contains(ref BoundingBox)

Determines whether the current objects contains a BoundingBox.

public ContainmentType Contains(ref BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

ContainmentType

The type of containment the two objects have.

Contains(ref BoundingSphere)

Determines whether the current objects contains a BoundingSphere.

public ContainmentType Contains(ref BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

ContainmentType

The type of containment the two objects have.

Contains(ref Vector3)

Determines whether the current objects contains a point.

public ContainmentType Contains(ref Vector3 point)

Parameters

point Vector3

The point to test.

Returns

ContainmentType

The type of containment the two objects have.

Equals(BoundingBox)

Determines whether the specified Vector4 is equal to this instance.

public bool Equals(BoundingBox value)

Parameters

value BoundingBox

The Vector4 to compare with this instance.

Returns

bool

true if the specified Vector4 is equal to this instance; otherwise, false.

Equals(object)

Determines whether the specified object is equal to this instance.

public override bool Equals(object value)

Parameters

value object

The object to compare with this instance.

Returns

bool

true if the specified object is equal to this instance; otherwise, false.

FromPoints(Vector3[])

Constructs a BoundingBox that fully contains the given points.

public static BoundingBox FromPoints(Vector3[] points)

Parameters

points Vector3[]

The points that will be contained by the box.

Returns

BoundingBox

The newly constructed bounding box.

Exceptions

ArgumentNullException

Thrown when points is null.

FromPoints(Vector3[], out BoundingBox)

Constructs a BoundingBox that fully contains the given points.

public static void FromPoints(Vector3[] points, out BoundingBox result)

Parameters

points Vector3[]

The points that will be contained by the box.

result BoundingBox

When the method completes, contains the newly constructed bounding box.

Exceptions

ArgumentNullException

Thrown when points is null.

FromSphere(BoundingSphere)

Constructs a BoundingBox from a given sphere.

public static BoundingBox FromSphere(BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere that will designate the extents of the box.

Returns

BoundingBox

The newly constructed bounding box.

FromSphere(ref BoundingSphere, out BoundingBox)

Constructs a BoundingBox from a given sphere.

public static void FromSphere(ref BoundingSphere sphere, out BoundingBox result)

Parameters

sphere BoundingSphere

The sphere that will designate the extents of the box.

result BoundingBox

When the method completes, contains the newly constructed bounding box.

GetCorners()

Retrieves the eight corners of the bounding box.

public Vector3[] GetCorners()

Returns

Vector3[]

An array of points representing the eight corners of the bounding box.

GetHashCode()

Returns a hash code for this instance.

public override int GetHashCode()

Returns

int

A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.

Intersects(ref BoundingBox)

Determines if there is an intersection between the current object and a BoundingBox.

public bool Intersects(ref BoundingBox box)

Parameters

box BoundingBox

The box to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref BoundingSphere)

Determines if there is an intersection between the current object and a BoundingSphere.

public bool Intersects(ref BoundingSphere sphere)

Parameters

sphere BoundingSphere

The sphere to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref Plane)

Determines if there is an intersection between the current object and a Plane.

public PlaneIntersectionType Intersects(ref Plane plane)

Parameters

plane Plane

The plane to test.

Returns

PlaneIntersectionType

Whether the two objects intersected.

Intersects(ref Ray)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray)

Parameters

ray Ray

The ray to test.

Returns

bool

Whether the two objects intersected.

Intersects(ref Ray, out Vector3)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray, out Vector3 point)

Parameters

ray Ray

The ray to test.

point Vector3

When the method completes, contains the point of intersection, or Zero if there was no intersection.

Returns

bool

Whether the two objects intersected.

Intersects(ref Ray, out float)

Determines if there is an intersection between the current object and a Ray.

public bool Intersects(ref Ray ray, out float distance)

Parameters

ray Ray

The ray to test.

distance float

When the method completes, contains the distance of the intersection, or 0 if there was no intersection.

Returns

bool

Whether the two objects intersected.

Merge(BoundingBox, BoundingBox)

Constructs a BoundingBox that is as large as the total combined area of the two specified boxes.

public static BoundingBox Merge(BoundingBox value1, BoundingBox value2)

Parameters

value1 BoundingBox

The first box to merge.

value2 BoundingBox

The second box to merge.

Returns

BoundingBox

The newly constructed bounding box.

Merge(ref BoundingBox, ref BoundingBox, out BoundingBox)

Constructs a BoundingBox that is as large as the total combined area of the two specified boxes.

public static void Merge(ref BoundingBox value1, ref BoundingBox value2, out BoundingBox result)

Parameters

value1 BoundingBox

The first box to merge.

value2 BoundingBox

The second box to merge.

result BoundingBox

When the method completes, contains the newly constructed bounding box.

Merge(ref BoundingBox, ref Vector3, out BoundingBox)

Constructs a BoundingBox that is as large enough to contains the bounding box and the given point.

public static void Merge(ref BoundingBox value1, ref Vector3 value2, out BoundingBox result)

Parameters

value1 BoundingBox

The box to merge.

value2 Vector3

The point to merge.

result BoundingBox

When the method completes, contains the newly constructed bounding box.

ToString()

Returns a string that represents this instance.

public override string ToString()

Returns

string

A string that represents this instance.

ToString(IFormatProvider)

Returns a string that represents this instance.

public string ToString(IFormatProvider formatProvider)

Parameters

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

ToString(string)

Returns a string that represents this instance.

public string ToString(string format)

Parameters

format string

The format.

Returns

string

A string that represents this instance.

ToString(string, IFormatProvider)

Returns a string that represents this instance.

public string ToString(string format, IFormatProvider formatProvider)

Parameters

format string

The format.

formatProvider IFormatProvider

The format provider.

Returns

string

A string that represents this instance.

Transform(ref BoundingBox, ref Matrix, out BoundingBox)

Transform a bounding box.

public static void Transform(ref BoundingBox value, ref Matrix transform, out BoundingBox result)

Parameters

value BoundingBox

The original bounding box.

transform Matrix

The transform to apply to the bounding box.

result BoundingBox

The transformed bounding box.

Operators

operator ==(BoundingBox, BoundingBox)

Tests for equality between two objects.

public static bool operator ==(BoundingBox left, BoundingBox right)

Parameters

left BoundingBox

The first value to compare.

right BoundingBox

The second value to compare.

Returns

bool

true if left has the same value as right; otherwise, false.

operator !=(BoundingBox, BoundingBox)

Tests for inequality between two objects.

public static bool operator !=(BoundingBox left, BoundingBox right)

Parameters

left BoundingBox

The first value to compare.

right BoundingBox

The second value to compare.

Returns

bool

true if left has a different value than right; otherwise, false.