Header menu logo Nu

Box2 Type

Defines an axis-aligned 2D box (rectangle). Copied from - https://github.com/opentk/opentk/blob/opentk5.0/src/OpenTK.Mathematics/Geometry/Box2.cs Heavily modified by BGE to more closely conform to System.Numerics and use a size-preserving representation ([min, size] instead of [min, max]).

Constructors

Constructor Description

Box2(min, size)

Full Usage: Box2(min, size)

Parameters:

Initializes a new instance of the Box2 struct.

min : Vector2
size : Vector2

Box2(minX, minY, sizeX, sizeY)

Full Usage: Box2(minX, minY, sizeX, sizeY)

Parameters:
    minX : float32
    minY : float32
    sizeX : float32
    sizeY : float32

Initializes a new instance of the Box2 struct.

minX : float32
minY : float32
sizeX : float32
sizeY : float32

Instance members

Instance member Description

this.Combine

Full Usage: this.Combine

Parameters:
Returns: Box2 Box containing area of both.

Combine area of box with a point.

point : Vector2
Returns: Box2

Box containing area of both.

this.Combine

Full Usage: this.Combine

Parameters:
Returns: Box2 Box containing area of both.

Combine area of two boxes.

box : Box2

Returns: Box2

Box containing area of both.

this.Contains

Full Usage: this.Contains

Parameters:
    box : Box2 - The Box2 to test for overlap.

Returns: ContainmentType A value indicating if this Box2 contains, intersects with or is disjoint with box.

Check if this Box2 contains another Box2.

box : Box2

The Box2 to test for overlap.

Returns: ContainmentType

A value indicating if this Box2 contains, intersects with or is disjoint with box.

this.Contains

Full Usage: this.Contains

Parameters:
    box : byref<Box2> - The Box2 to test for overlap.
    result : byref<ContainmentType> - A value indicating if this Box2 contains, intersects with or is disjoint with box.

Check if this Box2 contains another Box2.

box : byref<Box2>

The Box2 to test for overlap.

result : byref<ContainmentType>

A value indicating if this Box2 contains, intersects with or is disjoint with box.

this.Contains

Full Usage: this.Contains

Parameters:
Returns: ContainmentType ContainmentType.Contains if this Box2 contains point or ContainmentType.Disjoint if it does not.

Check if this Box2 contains a point.

point : Vector2

The Vector3 to test.

Returns: ContainmentType

ContainmentType.Contains if this Box2 contains point or ContainmentType.Disjoint if it does not.

this.Contains

Full Usage: this.Contains

Parameters:

Check if this Box2 contains a point.

point : byref<Vector2>

The Vector2 to test.

result : byref<ContainmentType>

ContainmentType.Contains if this Box2 contains point or ContainmentType.Disjoint if it does not.

this.ContainsExclusive

Full Usage: this.ContainsExclusive

Parameters:
    box : Box2 - The Box2 to test for overlap.

Returns: ContainmentType A value indicating if this Box2 contains, intersects with or is disjoint with box.

Check if this Box2 contains another Box2 AND no box outside of this box intersects with it.

box : Box2

The Box2 to test for overlap.

Returns: ContainmentType

A value indicating if this Box2 contains, intersects with or is disjoint with box.

this.ContainsExclusive

Full Usage: this.ContainsExclusive

Parameters:
    box : byref<Box2> - The Box2 to test for overlap.
    result : byref<ContainmentType> - A value indicating if this Box2 contains, intersects with or is disjoint with box.

Check if this Box2 contains another Box2 AND no box outside of this box intersects with it.

box : byref<Box2>

The Box2 to test for overlap.

result : byref<ContainmentType>

A value indicating if this Box2 contains, intersects with or is disjoint with box.

this.Equals

Full Usage: this.Equals

Parameters:
    obj : obj

Returns: bool
Modifiers: abstract
obj : obj
Returns: bool

this.Equals

Full Usage: this.Equals

Parameters:
Returns: bool
Modifiers: abstract
other : Box2
Returns: bool

this.GetHashCode

Full Usage: this.GetHashCode

Returns: int
Modifiers: abstract
Returns: int

this.Intersects

Full Usage: this.Intersects

Parameters:
Returns: bool
true
if this Box2 intersects point,
false
if it does not.

Check if this Box2 is intersected by a Vector2.

point : Vector2

The Vector2 to test for intersection.

Returns: bool

true
if this Box2 intersects point,
false
if it does not.

this.Intersects

Full Usage: this.Intersects

Parameters:
    point : inref<Vector2> - The Vector2 to test for intersection.
    result : byref<bool> -
    true
    
    if this Box2 intersects point,
    false
    
    if it does not.


Check if this Box2 is intersected by a Vector2.

point : inref<Vector2>

The Vector2 to test for intersection.

result : byref<bool>

true
if this Box2 intersects point,
false
if it does not.

this.Intersects

Full Usage: this.Intersects

Parameters:
    box : Box2 - The Box2 to test for intersection.

Returns: bool
true
if this Box2 intersects box,
false
if it does not.

Check if this Box2 intersects another Box2.

box : Box2

The Box2 to test for intersection.

Returns: bool

true
if this Box2 intersects box,
false
if it does not.

this.Intersects

Full Usage: this.Intersects

Parameters:
    box : inref<Box2> - The Box2 to test for intersection.
    result : byref<bool> -
    true
    
    if this Box2 intersects box,
    false
    
    if it does not.


Check if this Box2 intersects another Box2.

box : inref<Box2>

The Box2 to test for intersection.

result : byref<bool>

true
if this Box2 intersects box,
false
if it does not.

this.ScaleUniform

Full Usage: this.ScaleUniform

Parameters:
    scalar : float32

Returns: Box2

Resize the box by a scalar factor while keeping its center fixed.

scalar : float32
Returns: Box2

this.ToString

Full Usage: this.ToString

Returns: string
Modifiers: abstract
Returns: string

Static members

Static member Description

left <> right

Full Usage: left <> right

Parameters:
    left : Box2 - The left operand.
    right : Box2 - The right operand.

Returns: bool

Inequality comparator.

left : Box2

The left operand.

right : Box2

The right operand.

Returns: bool

left = right

Full Usage: left = right

Parameters:
    left : Box2 - The left operand.
    right : Box2 - The right operand.

Returns: bool

Equality comparator.

left : Box2

The left operand.

right : Box2

The right operand.

Returns: bool

Box2.Enclose(point, point2)

Full Usage: Box2.Enclose(point, point2)

Parameters:
Returns: Box2

Create a bounding box by enclosing two points.

point : Vector2
point2 : Vector2
Returns: Box2

Box2.Enclose(points)

Full Usage: Box2.Enclose(points)

Parameters:
Returns: Box2

Create a bounding box by enclosing multiple points.

points : Vector2[]
Returns: Box2

Type something to start searching.