Gorgon
Show / Hide Table of Contents

Struct GorgonBoundingBox

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

Implements
IGorgonEquatableByRef<GorgonBoundingBox>
IEquatable<GorgonBoundingBox>
Inherited Members
object.Equals(object, object)
object.ReferenceEquals(object, object)
object.GetType()
Namespace: Gorgon.Renderers.Data
Assembly: Gorgon.Core.dll
Syntax
public readonly struct GorgonBoundingBox : IGorgonEquatableByRef<GorgonBoundingBox>, IEquatable<GorgonBoundingBox>

Constructors

| Edit this page View Source

GorgonBoundingBox(Vector3, Vector3)

Initializes a new instance of the GorgonBoundingBox struct.

Declaration
public GorgonBoundingBox(Vector3 minimum, Vector3 maximum)
Parameters
Type Name Description
Vector3 minimum

The minimum vertex of the bounding box.

Vector3 maximum

The maximum vertex of the bounding box.

| Edit this page View Source

GorgonBoundingBox(float, float, float, float, float, float)

Initializes a new instance of the GorgonBoundingBox struct.

Declaration
public GorgonBoundingBox(float minX, float minY, float minZ, float maxX, float maxY, float maxZ)
Parameters
Type Name Description
float minX

The minimum x.

float minY

The minimum y.

float minZ

The minimum z.

float maxX

The maximum x.

float maxY

The maximum y.

float maxZ

The maximum z.

Fields

| Edit this page View Source

Empty

A default, empty, bounding box.

Declaration
public static readonly GorgonBoundingBox Empty
Field Value
Type Description
GorgonBoundingBox
| Edit this page View Source

Maximum

The maximum point of the box.

Declaration
public readonly Vector3 Maximum
Field Value
Type Description
Vector3
| Edit this page View Source

Minimum

The minimum point of the box.

Declaration
public readonly Vector3 Minimum
Field Value
Type Description
Vector3

Properties

| Edit this page View Source

Back

Property to return the back extent.

Declaration
public float Back { get; }
Property Value
Type Description
float
| Edit this page View Source

Bottom

Property to return the bottom extent.

Declaration
public float Bottom { get; }
Property Value
Type Description
float
| Edit this page View Source

BottomLeftBack

Property to return the bottom left point at the rear of the AABB.

Declaration
public Vector3 BottomLeftBack { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

BottomLeftFront

Property to return the bottom left point at the front of the AABB.

Declaration
public Vector3 BottomLeftFront { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

BottomRightBack

Property to return the bottom right point at the rear of the AABB.

Declaration
public Vector3 BottomRightBack { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

BottomRightFront

Property to return the bottom right point at the front of the AABB.

Declaration
public Vector3 BottomRightFront { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

Center

Returns the size of the bounding box

Declaration
public Vector3 Center { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

Depth

Returns the height of the bounding box

Declaration
public float Depth { get; }
Property Value
Type Description
float
| Edit this page View Source

Front

Property to return the front extent.

Declaration
public float Front { get; }
Property Value
Type Description
float
| Edit this page View Source

Height

Returns the height of the bounding box

Declaration
public float Height { get; }
Property Value
Type Description
float
| Edit this page View Source

IsEmpty

Property to return whether the AABB is empty or not.

Declaration
public bool IsEmpty { get; }
Property Value
Type Description
bool
| Edit this page View Source

this[int]

Property to return each of the 8 corners for the AABB.

Declaration
public Vector3 this[int index] { get; }
Parameters
Type Name Description
int index
Property Value
Type Description
Vector3
| Edit this page View Source

Left

Property to return the left extent.

Declaration
public float Left { get; }
Property Value
Type Description
float
| Edit this page View Source

Right

Property to return the right extent.

Declaration
public float Right { get; }
Property Value
Type Description
float
| Edit this page View Source

Size

Returns the size of the bounding box

Declaration
public Vector3 Size { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

Top

Property to return the top extent.

Declaration
public float Top { get; }
Property Value
Type Description
float
| Edit this page View Source

TopLeftBack

Property to return the top left point at the rear of the AABB.

Declaration
public Vector3 TopLeftBack { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

TopLeftFront

Property to return the top left point at the front of the AABB.

Declaration
public Vector3 TopLeftFront { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

TopRightBack

Property to return the top right point at the rear of the AABB.

Declaration
public Vector3 TopRightBack { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

TopRightFront

Property to return the top right point at the front of the AABB.

Declaration
public Vector3 TopRightFront { get; }
Property Value
Type Description
Vector3
| Edit this page View Source

Width

Returns the width of the bounding box

Declaration
public float Width { get; }
Property Value
Type Description
float

Methods

| Edit this page View Source

Equals(GorgonBoundingBox)

Determines whether the specified Vector4 is equal to this instance.

Declaration
public bool Equals(GorgonBoundingBox value)
Parameters
Type Name Description
GorgonBoundingBox value

The Vector4 to compare with this instance.

Returns
Type Description
bool

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

| Edit this page View Source

Equals(in GorgonBoundingBox)

Function to compare this instance with another.

Declaration
public bool Equals(in GorgonBoundingBox other)
Parameters
Type Name Description
GorgonBoundingBox other

The other instance to use for comparison.

Returns
Type Description
bool

true if equal, false if not.

| Edit this page View Source

Equals(object)

Determines whether the specified object is equal to this instance.

Declaration
public override bool Equals(object value)
Parameters
Type Name Description
object value

The object to compare with this instance.

Returns
Type Description
bool

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

Overrides
ValueType.Equals(object)
| Edit this page View Source

FromPoints(Span<Vector3>, out GorgonBoundingBox)

Constructs a GorgonBoundingBox that fully contains the given points.

Declaration
public static void FromPoints(Span<Vector3> points, out GorgonBoundingBox result)
Parameters
Type Name Description
Span<Vector3> points

The points that will be contained by the box.

GorgonBoundingBox result

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

| Edit this page View Source

FromSphere(in GorgonBoundingSphere, out GorgonBoundingBox)

Constructs a GorgonBoundingBox from a given sphere.

Declaration
public static void FromSphere(in GorgonBoundingSphere sphere, out GorgonBoundingBox result)
Parameters
Type Name Description
GorgonBoundingSphere sphere

The sphere that will designate the extents of the box.

GorgonBoundingBox result

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

| Edit this page View Source

GetHashCode()

Returns a hash code for this instance.

Declaration
public override int GetHashCode()
Returns
Type Description
int

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

Overrides
ValueType.GetHashCode()
| Edit this page View Source

Intersect(in GorgonBoundingBox, in GorgonBoundingBox, out GorgonBoundingBox)

Function to intersect two Axis Aligned Bounding Boxes.

Declaration
public static void Intersect(in GorgonBoundingBox aabb1, in GorgonBoundingBox aabb2, out GorgonBoundingBox result)
Parameters
Type Name Description
GorgonBoundingBox aabb1

The first axis aligned bounding box.

GorgonBoundingBox aabb2

The second axis aligned bounding box.

GorgonBoundingBox result

The intersection of both bounding boxes.

| Edit this page View Source

Merge(in GorgonBoundingBox, in GorgonBoundingBox, out GorgonBoundingBox)

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

Declaration
public static void Merge(in GorgonBoundingBox value1, in GorgonBoundingBox value2, out GorgonBoundingBox result)
Parameters
Type Name Description
GorgonBoundingBox value1

The first box to merge.

GorgonBoundingBox value2

The second box to merge.

GorgonBoundingBox result

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

| Edit this page View Source

ToString()

Returns a string that represents this instance.

Declaration
public override string ToString()
Returns
Type Description
string

A string that represents this instance.

Overrides
ValueType.ToString()
| Edit this page View Source

Transform(in GorgonBoundingBox, in Matrix4x4, out GorgonBoundingBox)

Function to transform an AABB by a world matrix.

Declaration
public static void Transform(in GorgonBoundingBox aabb, in Matrix4x4 worldMatrix, out GorgonBoundingBox result)
Parameters
Type Name Description
GorgonBoundingBox aabb

The axis aligned bounding box to transform.

Matrix4x4 worldMatrix

The world matrix to multiply by.

GorgonBoundingBox result

The new transformed axis aligned bounding box.

Operators

| Edit this page View Source

operator ==(in GorgonBoundingBox, in GorgonBoundingBox)

Tests for equality between two objects.

Declaration
public static bool operator ==(in GorgonBoundingBox left, in GorgonBoundingBox right)
Parameters
Type Name Description
GorgonBoundingBox left

The first value to compare.

GorgonBoundingBox right

The second value to compare.

Returns
Type Description
bool

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

| Edit this page View Source

operator !=(in GorgonBoundingBox, in GorgonBoundingBox)

Tests for inequality between two objects.

Declaration
public static bool operator !=(in GorgonBoundingBox left, in GorgonBoundingBox right)
Parameters
Type Name Description
GorgonBoundingBox left

The first value to compare.

GorgonBoundingBox right

The second value to compare.

Returns
Type Description
bool

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

Implements

IGorgonEquatableByRef<T>
IEquatable<T>

Extension Methods

GorgonNullExtensions.AsNullable<T>(object)
GorgonNullExtensions.IfNull<T>(object, T)
GorgonNullExtensions.IsNull(object)
  • Edit this page
  • View Source
In this article
Back to top Copyright 2023 - Licensed under the MIT license by Michael Winsor (Tape_Worm).
Send comments on this topic to the author