MutableRect


An mutable, 2D, axis-aligned, floating-point rectangle whose coordinates are relative to a given origin.

Summary

Public constructors

MutableRect(left: Float, top: Float, right: Float, bottom: Float)
Cmn

Public functions

operator Boolean
contains(offset: Offset)

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Cmn
Unit
intersect(left: Float, top: Float, right: Float, bottom: Float)

Modifies this to be the intersection of this and the rect formed by left, top, right, and bottom.

Cmn
Unit
set(left: Float, top: Float, right: Float, bottom: Float)

Sets new bounds to (left, top, right, bottom)

Cmn
open String
Cmn

Public properties

Float

The offset of the bottom edge of this rectangle from the y axis.

Cmn
Float

The distance between the top and bottom edges of this rectangle.

Cmn
Boolean

Whether this rectangle encloses a non-zero area.

Cmn
Float

The offset of the left edge of this rectangle from the x axis.

Cmn
Float

The offset of the right edge of this rectangle from the x axis.

Cmn
Size

The distance between the upper-left corner and the lower-right corner of this rectangle.

Cmn
Float

The offset of the top edge of this rectangle from the y axis.

Cmn
Float

The distance between the left and right edges of this rectangle.

Cmn

Extension functions

Rect
Cmn

Public constructors

MutableRect

MutableRect(left: Float, top: Float, right: Float, bottom: Float)
Parameters
left: Float

The offset of the left edge of this rectangle from the x axis.

top: Float

The offset of the top edge of this rectangle from the y axis.

right: Float

The offset of the right edge of this rectangle from the x axis.

bottom: Float

The offset of the bottom edge of this rectangle from the y axis.

Public functions

contains

operator fun contains(offset: Offset): Boolean

Whether the point specified by the given offset (which is assumed to be relative to the origin) lies between the left and right and the top and bottom edges of this rectangle.

Rectangles include their top and left edges but exclude their bottom and right edges.

intersect

fun intersect(left: Float, top: Float, right: Float, bottom: Float): Unit

Modifies this to be the intersection of this and the rect formed by left, top, right, and bottom.

set

fun set(left: Float, top: Float, right: Float, bottom: Float): Unit

Sets new bounds to (left, top, right, bottom)

toString

open fun toString(): String

Public properties

bottom

var bottomFloat

The offset of the bottom edge of this rectangle from the y axis.

height

val heightFloat

The distance between the top and bottom edges of this rectangle.

isEmpty

val isEmptyBoolean

Whether this rectangle encloses a non-zero area. Negative areas are considered empty.

left

var leftFloat

The offset of the left edge of this rectangle from the x axis.

right

var rightFloat

The offset of the right edge of this rectangle from the x axis.

size

val sizeSize

The distance between the upper-left corner and the lower-right corner of this rectangle.

top

var topFloat

The offset of the top edge of this rectangle from the y axis.

width

val widthFloat

The distance between the left and right edges of this rectangle.

Extension functions