Box2I

Description

struct Tinman.Terrain.Util.Box2I

Derived from

IBox2Ops<Box2I, Vec2I, int32, int64>

A two-dimensional bounding box with 32-bit integer precision.

The coordinates refer to blocks (pixel-is-area semantic).

    0 1 2 3 4 5

0   . . . . . .   X1 := 1, Y1 := 2
1   . . . . . .
2   . # # # . .   X2 := 3, Y2 := 3
3   . # # # . .
4   . . . . . .   Width := 3, Height := 2
5   . . . . . .

Public / Constants

Empty


public static readonly attribute Empty → (Box2I)

An empty bounding box at the coordinate origin.

See also

Box2I.IsEmpty

Inverse


public static readonly attribute Inverse → (Box2I)

An inverse bounding box that can be used as the initial value for computing bounds via subsequent calls to Grow.

See also

Box2I.IsInverse

Max


public static readonly attribute Max → (Box2I)

The largest possible box.

Note that the dimension of this box is 2^32 (4294967296), which cannot be expressed using 32-bits. So instead 0 is returned.

Public / Constructors

From​Points

2 overloads


[Pure]
public static method FromPoints1 → (4)

x1 in : int32

X-coordinate of first corner point (inclusive).

y1 in : int32

Y-coordinate of first corner point (inclusive).

x2 in : int32

X-coordinate of second corner point (inclusive).

y2 in : int32

Y-coordinate of second corner point (inclusive).

returns → Box2I

The bounding box.

Creates a new instance of Box2I from the given corner points.


[Pure]
public static method FromPoints2 → (2)

in : Vec2I

First corner point (inclusive).

in : Vec2I

Second corner point (inclusive).

returns → Box2I

The bounding box.

Creates a new instance of Box2I from the given corner points.

From​Rect


[Pure]
public static method FromRect → (4)

in : int32

X-coordinate of top-left corner of rectangle.

in : int32

Y-coordinate of top-left corner of rectangle.

width in : int32

Width of rectangle.

height in : int32

Height of rectangle.

returns → Box2I

The bounding box.

Creates a new instance of Box2I from the given rectangle.

Public / Attributes

X1


public readonly attribute X1 → (int32)

X-coordinate of minimum corner of bounding box.

X2


public readonly attribute X2 → (int32)

X-coordinate of maximum corner of bounding box.

Y1


public readonly attribute Y1 → (int32)

Y-coordinate of minimum corner of bounding box.

Y2


public readonly attribute Y2 → (int32)

Y-coordinate of maximum corner of bounding box.

Serialization

Serializer


public static readonly attribute Serializer → (ITypeSerializer<Box2I>)

The serialization helper object for values of Box2I.