Table of Contents

Struct AABB

Namespace
ValveResourceFormat.Renderer
Assembly
Renderer.dll

Axis-aligned bounding box for spatial queries and culling.

public readonly struct AABB : IEquatable<AABB>

Implements

Inherited Members

Constructors

AABB(Vector3, Vector3)

Initializes a new bounding box from minimum and maximum corners.

public AABB(Vector3 min, Vector3 max)

Parameters

min Vector3

Minimum corner.

max Vector3

Maximum corner.

AABB(Vector3, float)

Initializes a new bounding box centered at a point with uniform extents.

public AABB(Vector3 point, float halfExtents)

Parameters

point Vector3

Center point.

halfExtents float

Half-size along each axis.

AABB(float, float, float, float, float, float)

Initializes a new bounding box from individual coordinate components.

public AABB(float min_x, float min_y, float min_z, float max_x, float max_y, float max_z)

Parameters

min_x float
min_y float
min_z float
max_x float
max_y float
max_z float

Fields

Max

Maximum corner of the bounding box.

public readonly Vector3 Max

Field Value

Vector3

Min

Minimum corner of the bounding box.

public readonly Vector3 Min

Field Value

Vector3

Properties

Center

Gets the center point of the bounding box.

public Vector3 Center { get; }

Property Value

Vector3

Size

Gets the size of the bounding box.

public Vector3 Size { get; }

Property Value

Vector3

Methods

Contains(Vector3)

Tests if a point is inside this bounding box.

public bool Contains(Vector3 point)

Parameters

point Vector3

The point to test.

Returns

bool

true if the point is inside the box.

Contains(in AABB)

Tests if another bounding box is completely inside this one.

public bool Contains(in AABB other)

Parameters

other AABB

The other bounding box.

Returns

bool

true if the other box is fully contained.

Encapsulate(in Vector3)

Expands this bounding box to include a point.

public AABB Encapsulate(in Vector3 point)

Parameters

point Vector3

The point to include.

Returns

AABB

A new bounding box that contains the original box and the point.

Equals(AABB)

Indicates whether the current object is equal to another object of the same type.

public bool Equals(AABB other)

Parameters

other AABB

An object to compare with this object.

Returns

bool

true if the current object is equal to the other parameter; otherwise, false.

Equals(object?)

Indicates whether this instance and a specified object are equal.

public override bool Equals(object? obj)

Parameters

obj object?

The object to compare with the current instance.

Returns

bool

true if obj and this instance are the same type and represent the same value; otherwise, false.

GetHashCode()

Returns the hash code for this instance.

public override int GetHashCode()

Returns

int

A 32-bit signed integer that is the hash code for this instance.

Intersects(in AABB)

Tests if another bounding box intersects this one.

public bool Intersects(in AABB other)

Parameters

other AABB

The other bounding box.

Returns

bool

true if the boxes overlap.

ToString()

Returns the fully qualified type name of this instance.

public override string ToString()

Returns

string

The fully qualified type name.

Transform(in Matrix4x4)

Transforms this bounding box by a matrix and returns an axis-aligned result.

public AABB Transform(in Matrix4x4 transform)

Parameters

transform Matrix4x4

The transformation matrix.

Returns

AABB

A new axis-aligned bounding box that contains the transformed box.

Remarks

The resulting AABB may be larger than the original if rotation is involved. To minimize error accumulation, premultiply matrices before transforming.

Translate(in Vector3)

Translates this bounding box by an offset.

public AABB Translate(in Vector3 offset)

Parameters

offset Vector3

The translation offset.

Returns

AABB

A new bounding box at the translated position.

Union(in AABB)

Computes the union of this bounding box with another.

public AABB Union(in AABB other)

Parameters

other AABB

The other bounding box.

Returns

AABB

A new bounding box that contains both boxes.

Operators

operator ==(AABB, AABB)

Checks if two bounding boxes are equal.

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

Parameters

left AABB
right AABB

Returns

bool

operator !=(AABB, AABB)

Checks if two bounding boxes are not equal.

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

Parameters

left AABB
right AABB

Returns

bool