Show / Hide Table of Contents

Struct Box3i

Defines an axis-aligned 3d box (rectangular prism).

Implements
IEquatable<Box3i>
IFormattable
Inherited Members
object.Equals(object, object)
object.GetType()
object.ReferenceEquals(object, object)
Namespace: OpenTK.Mathematics
Assembly: OpenTK.Mathematics.dll
Syntax
[Serializable]
public struct Box3i : IEquatable<Box3i>, IFormattable

Constructors

Box3i(Vector3i, Vector3i)

Initializes a new instance of the Box3i struct.

Declaration
public Box3i(Vector3i min, Vector3i max)
Parameters
Type Name Description
Vector3i min

The minimum point in 3D space this box encloses.

Vector3i max

The maximum point in 3D space this box encloses.

Box3i(int, int, int, int, int, int)

Initializes a new instance of the Box3i struct.

Declaration
public Box3i(int minX, int minY, int minZ, int maxX, int maxY, int maxZ)
Parameters
Type Name Description
int minX

The minimum X value to be enclosed.

int minY

The minimum Y value to be enclosed.

int minZ

The minimum Z value to be enclosed.

int maxX

The maximum X value to be enclosed.

int maxY

The maximum Y value to be enclosed.

int maxZ

The maximum Z value to be enclosed.

Fields

Empty

An empty box with Min (0, 0, 0) and Max (0, 0, 0).

Declaration
public static readonly Box3i Empty
Field Value
Type Description
Box3i

Properties

Center

Gets a vector describing the center of the box.

Declaration
public readonly Vector3 Center { get; }
Property Value
Type Description
Vector3

HalfSize

Gets or sets a vector describing half the size of the box.

Declaration
public Vector3i HalfSize { get; set; }
Property Value
Type Description
Vector3i

Max

Gets or sets the maximum boundary of the structure.

Declaration
public Vector3i Max { readonly get; set; }
Property Value
Type Description
Vector3i

Min

Gets or sets the minimum boundary of the structure.

Declaration
public Vector3i Min { readonly get; set; }
Property Value
Type Description
Vector3i

Size

Gets a vector describing the size of the Box3i structure.

Declaration
public Vector3i Size { get; }
Property Value
Type Description
Vector3i

Methods

Contains(Box3i)

Returns whether the box contains the specified box (borders inclusive).

Declaration
[Pure]
public readonly bool Contains(Box3i other)
Parameters
Type Name Description
Box3i other

The box to query.

Returns
Type Description
bool

Whether this box contains the other box.

Contains(Vector3i, bool)

Returns whether the box contains the specified point.

Declaration
[Pure]
public bool Contains(Vector3i point, bool boundaryInclusive)
Parameters
Type Name Description
Vector3i point

The point to query.

bool boundaryInclusive

Whether points on the box boundary should be recognised as contained as well.

Returns
Type Description
bool

Whether this box contains the point.

Contains(Vector3i)

Returns whether the box contains the specified point (borders inclusive).

Declaration
[Pure]
[Obsolete("This function excludes borders even though it's documentation says otherwise. Use ContainsInclusive and ContainsExclusive for the desired behaviour.")]
public readonly bool Contains(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to query.

Returns
Type Description
bool

Whether this box contains the point.

ContainsExclusive(Vector3i)

Returns whether the box contains the specified point (borders exclusive).

Declaration
[Pure]
public readonly bool ContainsExclusive(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to query.

Returns
Type Description
bool

Whether this box contains the point.

ContainsInclusive(Vector3i)

Returns whether the box contains the specified point (borders inclusive).

Declaration
[Pure]
public readonly bool ContainsInclusive(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to query.

Returns
Type Description
bool

Whether this box contains the point.

DistanceToNearestEdge(Vector3i)

Returns the distance between the nearest edge and the specified point.

Declaration
[Pure]
public readonly float DistanceToNearestEdge(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to find distance for.

Returns
Type Description
float

The distance between the specified point and the nearest edge.

Equals(Box3i)

Declaration
public bool Equals(Box3i other)
Parameters
Type Name Description
Box3i other
Returns
Type Description
bool

Equals(object)

Declaration
public override bool Equals(object obj)
Parameters
Type Name Description
object obj
Returns
Type Description
bool
Overrides
ValueType.Equals(object)

Extend(Vector3i)

Extend this Box3i to encapsulate a given point.

Declaration
public void Extend(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to contain.

Extended(Vector3i)

Extend this Box3i to encapsulate a given point.

Declaration
[Pure]
public readonly Box3i Extended(Vector3i point)
Parameters
Type Name Description
Vector3i point

The point to contain.

Returns
Type Description
Box3i

The inflated box.

GetHashCode()

Declaration
public override readonly int GetHashCode()
Returns
Type Description
int
Overrides
ValueType.GetHashCode()

Inflate(Vector3i)

Inflates this Box3i by the given size in all directions. A negative size will shrink the box to a maximum of -HalfSize. Use the Extend(Vector3i) method for the point-encapsulation functionality in OpenTK version 4.8.1 and earlier.

Declaration
public void Inflate(Vector3i size)
Parameters
Type Name Description
Vector3i size

The size to inflate by.

Inflated(Vector3i)

Inflates this Box3i by the given size in all directions. A negative size will shrink the box to a maximum of -HalfSize. Use the Extended(Vector3i) method for the point-encapsulation functionality in eOpenTK version 4.8.1 and earlier.

Declaration
[Pure]
public readonly Box3i Inflated(Vector3i size)
Parameters
Type Name Description
Vector3i size

The size to inflate by.

Returns
Type Description
Box3i

The inflated box.

Scale(Vector3i, Vector3i)

Scales this Box3i by the given amount.

Declaration
public void Scale(Vector3i scale, Vector3i anchor)
Parameters
Type Name Description
Vector3i scale

The scale to scale the box.

Vector3i anchor

The anchor to scale the box from.

Scaled(Vector3i, Vector3i)

Returns a Box3i scaled by a given amount from an anchor point.

Declaration
[Pure]
public readonly Box3i Scaled(Vector3i scale, Vector3i anchor)
Parameters
Type Name Description
Vector3i scale

The scale to scale the box.

Vector3i anchor

The anchor to scale the box from.

Returns
Type Description
Box3i

The scaled box.

ToString()

Declaration
public override string ToString()
Returns
Type Description
string
Overrides
ValueType.ToString()

ToString(IFormatProvider)

Declaration
public string ToString(IFormatProvider formatProvider)
Parameters
Type Name Description
IFormatProvider formatProvider
Returns
Type Description
string

ToString(string, IFormatProvider)

Declaration
public string ToString(string format, IFormatProvider formatProvider)
Parameters
Type Name Description
string format
IFormatProvider formatProvider
Returns
Type Description
string

ToString(string)

Declaration
public string ToString(string format)
Parameters
Type Name Description
string format
Returns
Type Description
string

Translate(Vector3i)

Translates this Box3i by the given amount.

Declaration
public void Translate(Vector3i distance)
Parameters
Type Name Description
Vector3i distance

The distance to translate the box.

Translated(Vector3i)

Returns a Box3i translated by the given amount.

Declaration
[Pure]
public readonly Box3i Translated(Vector3i distance)
Parameters
Type Name Description
Vector3i distance

The distance to translate the box.

Returns
Type Description
Box3i

The translated box.

Operators

operator ==(Box3i, Box3i)

Equality comparator.

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

The left operand.

Box3i right

The right operand.

Returns
Type Description
bool

operator !=(Box3i, Box3i)

Inequality comparator.

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

The left operand.

Box3i right

The right operand.

Returns
Type Description
bool

Implements

IEquatable<T>
IFormattable
In This Article
Back to top Generated by DocFX