BBox
Sandbox.System
Derives from ValueType
Implements IEquatable<BBox>

Summary

An Axis Aligned Bounding Box. PAIN DAY TODO: We should probably name this better. BoundingBox, AxisAlignedBoundingBox, or something else. AxisAlignedBounds?

Constructors

BBox( Vector3 mins, Vector3 maxs, )

Initialize an AABB with given mins and maxs corners. See Vector3.Sort.

BBox( Vector3 center, )

Initializes a zero sized BBox with given center.

Fields

The maximum corner extents of the AABB. Values on each axis should be mathematically larger than values on the same axis of BBox.Mins. See Vector3.Sort

The minimum corner extents of the AABB. Values on each axis should be mathematically smaller than values on the same axis of BBox.Maxs. See Vector3.Sort

Properties

Vector3 Center { get; }

Calculated center of the AABB.

IEnumerable<Vector3> Corners { get; }

An enumerable that contains all corners of this AABB.

Returns a random point within this AABB.

Vector3 Size { get; }

Calculated size of the AABB on each axis.

float Volume { get; }

Returns the physical volume of this AABB.

Methods

static BBox FromHeightAndRadius( float height, float radius, )

Creates an AABB of length and depth, and given

static BBox FromPositionAndSize( Vector3 center, float size, )

Creates an AABB at given position and given which acts as a diameter of a sphere contained within the AABB.

static BBox FromPositionAndSize( Vector3 center, Vector3 size, )

Creates an AABB at given position and given a.k.a. "extents".

BBox AddPoint( Vector3 point, )

Returns this bbox but stretched to include given point

Returns the closest point on this AABB to another point

bool Contains( BBox b, )

Returns true if this AABB completely contains given AABB

bool Contains( Vector3 b, )

Returns true if this AABB contains given point

bool Overlaps( BBox b, )

Returns true if this AABB somewhat overlaps given AABB

override bool Equals( object obj, )
Overrides ValueType.Equals
override bool Equals( BBox o, )
Overrides ValueType.Equals
override int GetHashCode( )
Overrides ValueType.GetHashCode
override string ToString( )
Overrides ValueType.ToString

Formats this AABB into a string "mins x,y,z, maxs x,y,z"

Operators

BBox +( BBox c1, Vector3 c2,  )
bool ==( BBox left, BBox right,  )
bool !=( BBox left, BBox right,  )
BBox *( BBox c1, float c2,  )