Struct BoundingBox
- Namespace
- HelixToolkit.Maths
- Assembly
- HelixToolkit.Maths.dll
Represents an axis-aligned bounding box in three dimensional space.
public struct BoundingBox : IEquatable<BoundingBox>, IFormattable
- Implements
- Inherited Members
- Extension Methods
Constructors
BoundingBox(Vector3, Vector3)
Initializes a new instance of the BoundingBox struct.
public BoundingBox(Vector3 minimum, Vector3 maximum)
Parameters
minimumVector3The minimum vertex of the bounding box.
maximumVector3The maximum vertex of the bounding box.
Fields
Maximum
The maximum point of the box.
public Vector3 Maximum
Field Value
Minimum
The minimum point of the box.
public Vector3 Minimum
Field Value
Properties
Center
Returns the center point of the bounding box
public readonly Vector3 Center { get; }
Property Value
Depth
Returns the depth of the bounding box
public readonly float Depth { get; }
Property Value
Height
Returns the height of the bounding box
public readonly float Height { get; }
Property Value
Size
Returns the size of the bounding box
public readonly Vector3 Size { get; }
Property Value
Width
Returns the width of the bounding box
public readonly float Width { get; }
Property Value
Methods
Contains(BoundingBox)
Determines whether the current objects contains a BoundingBox.
public ContainmentType Contains(BoundingBox box)
Parameters
boxBoundingBoxThe box to test.
Returns
- ContainmentType
The type of containment the two objects have.
Contains(ref BoundingBox)
Determines whether the current objects contains a BoundingBox.
public ContainmentType Contains(ref BoundingBox box)
Parameters
boxBoundingBoxThe box to test.
Returns
- ContainmentType
The type of containment the two objects have.
Contains(BoundingSphere)
Determines whether the current objects contains a BoundingSphere.
public ContainmentType Contains(BoundingSphere sphere)
Parameters
sphereBoundingSphereThe sphere 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
sphereBoundingSphereThe sphere to test.
Returns
- ContainmentType
The type of containment the two objects have.
Contains(Vector3)
Determines whether the current objects contains a point.
public ContainmentType Contains(Vector3 point)
Parameters
pointVector3The point 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
pointVector3The 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 readonly bool Equals(BoundingBox value)
Parameters
valueBoundingBoxThe Vector4 to compare with this instance.
Returns
Equals(ref BoundingBox)
Determines whether the specified Vector4 is equal to this instance.
public readonly bool Equals(ref BoundingBox value)
Parameters
valueBoundingBoxThe Vector4 to compare with this instance.
Returns
Equals(object?)
Determines whether the specified object is equal to this instance.
public override readonly bool Equals(object? obj)
Parameters
Returns
FromPoints(Vector3[])
Constructs a BoundingBox that fully contains the given points.
public static BoundingBox FromPoints(Vector3[] points)
Parameters
pointsVector3[]The points that will be contained by the box.
Returns
- BoundingBox
The newly constructed bounding box.
Exceptions
- ArgumentNullException
Thrown when
pointsisnull.
FromPoints(Vector3[], out BoundingBox)
Constructs a BoundingBox that fully contains the given points.
public static void FromPoints(Vector3[] points, out BoundingBox result)
Parameters
pointsVector3[]The points that will be contained by the box.
resultBoundingBoxWhen the method completes, contains the newly constructed bounding box.
Exceptions
- ArgumentNullException
Thrown when
pointsisnull.
FromSphere(BoundingSphere)
Constructs a BoundingBox from a given sphere.
public static BoundingBox FromSphere(BoundingSphere sphere)
Parameters
sphereBoundingSphereThe 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
sphereBoundingSphereThe sphere that will designate the extents of the box.
resultBoundingBoxWhen the method completes, contains the newly constructed bounding box.
GetCorners()
Retrieves the eight corners of the bounding box.
public readonly Vector3[] GetCorners()
Returns
- Vector3[]
An array of points representing the eight corners of the bounding box.
GetCorners(Vector3[])
Retrieves the eight corners of the bounding box.
public readonly void GetCorners(Vector3[] corners)
Parameters
cornersVector3[]
GetHashCode()
Returns a hash code for this instance.
public override readonly int GetHashCode()
Returns
- int
A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.
Intersects(BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(BoundingBox box)
Parameters
boxBoundingBoxThe box to test.
Returns
- bool
Whether the two objects intersected.
Intersects(ref BoundingBox)
Determines if there is an intersection between the current object and a BoundingBox.
public bool Intersects(ref BoundingBox box)
Parameters
boxBoundingBoxThe box to test.
Returns
- bool
Whether the two objects intersected.
Intersects(BoundingSphere)
Determines if there is an intersection between the current object and a BoundingSphere.
public bool Intersects(BoundingSphere sphere)
Parameters
sphereBoundingSphereThe sphere 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
sphereBoundingSphereThe sphere to test.
Returns
- bool
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
rayRayThe 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
rayRayThe ray to test.
pointVector3When 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
rayRayThe ray to test.
distancefloatWhen the method completes, contains the distance of the intersection, or 0 if there was no intersection.
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
planePlaneThe plane to test.
Returns
- PlaneIntersectionType
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
value1BoundingBoxThe first box to merge.
value2BoundingBoxThe 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
value1BoundingBoxThe first box to merge.
value2BoundingBoxThe second box to merge.
resultBoundingBoxWhen the method completes, contains the newly constructed bounding box.
ToString()
Returns a string that represents this instance.
public override readonly string ToString()
Returns
ToString(IFormatProvider)
Returns a string that represents this instance.
public readonly string ToString(IFormatProvider formatProvider)
Parameters
formatProviderIFormatProviderThe format provider.
Returns
ToString(string)
Returns a string that represents this instance.
public readonly string ToString(string format)
Parameters
formatstringThe format.
Returns
ToString(string?, IFormatProvider?)
Returns a string that represents this instance.
public readonly string ToString(string? format, IFormatProvider? formatProvider)
Parameters
formatstringThe format.
formatProviderIFormatProviderThe format provider.
Returns
Operators
operator ==(BoundingBox, BoundingBox)
Tests for equality between two objects.
public static bool operator ==(BoundingBox left, BoundingBox right)
Parameters
leftBoundingBoxThe first value to compare.
rightBoundingBoxThe second value to compare.
Returns
- bool
trueiflefthas the same value asright; otherwise,false.
operator !=(BoundingBox, BoundingBox)
Tests for inequality between two objects.
public static bool operator !=(BoundingBox left, BoundingBox right)
Parameters
leftBoundingBoxThe first value to compare.
rightBoundingBoxThe second value to compare.
Returns
- bool
trueiflefthas a different value thanright; otherwise,false.