IBox2Ops

Description

[StaticTemplate]
interface Tinman.Terrain.Util.IBox2Ops
<TBox val : IBoxOps<TBox, TCoords, TCoord>>
<TCoords val>
<TCoord val>
<TCoord2 out val>

Derived from

IBoxOps<TBox, TCoords, TCoord>

Extended by

Box2D struct
Box2F struct
Box2I struct
Box2L struct

Defines common operations for 2D box values.

Public / Methods

Clamp


[Pure]
public method Clamp → (2)

in : TCoord

X-coordinate of point.

in : TCoord

Y-coordinate of point.

returns → TCoords

The clamped point.

Clamps the given point to this box.

Contains


[Pure]
public method Contains → (2)

in : TCoord

The point X-coordinate.

in : TCoord

The point Y-coordinate.

returns → bool

true if this box contains the point, false if not.

Checks if this box contains the given point.

Grow


[Pure]
public method Grow → (2)

in : TCoord

X-coordinate of point to cover (can be NaN).

in : TCoord

Y-coordinate of point to cover (can be NaN).

returns → TBox

The resulting box.

Enlarges the extends of this box so that it covers the given point.

Pad


[Pure]
public method Pad → (4)

top in : TCoord

The amount by which to decrease Y1.

left in : TCoord

The amount by which to decrease X1.

bottom in : TCoord

The amount by which to increase Y2.

right in : TCoord

The amount by which to increase X2.

returns → TBox

The padded bounding box.

Pads this bounding box by moving the edges individually.

Translate


[Pure]
public method Translate → (2)

in : TCoord

Translation amount along X-axis.

in : TCoord

Translation amount along Y-axis.

returns → TBox

The resulting bounding box.

Translates this bounding box.

Public / Attributes

Area


public attribute Area → (get)

value : TCoord2

[>=0]
The bounding box area.

Returns the area of this bounding box.

The area will always be 0 when IBoxOps.IsEmpty returns true.

Bottom​Left


public attribute BottomLeft → (get)

value : TCoords

The bottom-left corner: minimum X edge, maximum Y edge.

Returns the bottom-left corner of this box.

Bottom​Right


public attribute BottomRight → (get)

value : TCoords

The bottom-right corner: maximum X edge, maximum Y edge.

Returns the bottom-right corner of this box.

Height


public attribute Height → (get)

value : TCoord

[>=0]
The box height.

Returns the extends of this box along the Y-axis.

Size


public attribute Size → (get)

value : TCoords

The box Width and Height.

Returns the size of this box.

Top​Left


public attribute TopLeft → (get)

value : TCoords

The top-left corner: minimum X edge, minimum Y edge.

Returns the top-left corner of this box.

Top​Right


public attribute TopRight → (get)

value : TCoords

The top-right corner: maximum X edge, minimum Y edge.

Returns the top-right corner of this box.

Width


public attribute Width → (get)

value : TCoord

[>=0]
The box width.

Returns the extends of this box along the X-axis.