ImmutableBox


class ImmutableBox : Box


An immutable axis-aligned rectangle. See MutableBox for a mutable version.

Note that unlike android.graphics.RectF, this does not express an opinion about axis direction (e.g. the positive Y axis being "down"), because it is intended to be used with any coordinate system rather than just Android screen/View space.

Summary

Public companion functions

ImmutableBox
fromCenterAndDimensions(
    center: Vec,
    width: @FloatRange(from = 0.0) Float,
    height: @FloatRange(from = 0.0) Float
)

Constructs an ImmutableBox with a given center, width, and height.

ImmutableBox
fromTwoPoints(point1: Vec, point2: Vec)

Constructs the smallest ImmutableBox containing the two given points.

Public functions

open operator Boolean
equals(other: Any?)
open Int
open String

Public properties

open Float

The upper bound in the X direction.

open Float

The lower bound in the X direction.

open Float

The upper bound in the Y direction.

open Float

The lower bound in the Y direction.

Inherited functions

From androidx.ink.geometry.Box
MutableVec

Populates outVec with the center of the Box, and returns outVec.

Unit
computeCorners(
    outVecXMinYMin: MutableVec,
    outVecXMaxYMin: MutableVec,
    outVecXMaxYMax: MutableVec,
    outVecXMinYMax: MutableVec
)

Populates the 4 output points with the corners of the Box.

operator Boolean
contains(otherBox: Box)

Returns whether the other Box is contained within this Box.

operator Boolean
contains(point: Vec)

Returns whether the given point is contained within the Box.

Boolean
isAlmostEqual(other: Box, tolerance: @FloatRange(from = 0.0) Float)

Compares this Box with other, and returns true if the difference between xMin and other.xMin is less than tolerance, and likewise for xMax, yMin, and yMax.

Inherited properties

From androidx.ink.geometry.Box
Float

The height of the rectangle.

Float

The width of the rectangle.

Public companion functions

fromCenterAndDimensions

Added in 1.0.0-alpha01
fun fromCenterAndDimensions(
    center: Vec,
    width: @FloatRange(from = 0.0) Float,
    height: @FloatRange(from = 0.0) Float
): ImmutableBox

Constructs an ImmutableBox with a given center, width, and height.

fromTwoPoints

Added in 1.0.0-alpha01
fun fromTwoPoints(point1: Vec, point2: Vec): ImmutableBox

Constructs the smallest ImmutableBox containing the two given points.

Public functions

equals

open operator fun equals(other: Any?): Boolean

hashCode

open fun hashCode(): Int

toString

open fun toString(): String

Public properties

xMax

Added in 1.0.0-alpha01
open val xMaxFloat

The upper bound in the X direction.

xMin

Added in 1.0.0-alpha01
open val xMinFloat

The lower bound in the X direction.

yMax

Added in 1.0.0-alpha01
open val yMaxFloat

The upper bound in the Y direction.

yMin

Added in 1.0.0-alpha01
open val yMinFloat

The lower bound in the Y direction.