# MutableBox

Artifact: [androidx.ink:ink-geometry](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/geometry/MutableBox.kt+class:androidx.ink.geometry.MutableBox) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class MutableBox : Box
  ```

|---|---|---|
| [kotlin.Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html) |||
| ↳ | [androidx.ink.geometry.Box](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box) ||
|   | ↳ | [androidx.ink.geometry.MutableBox](https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox) |

*** ** * ** ***

A mutable axis-aligned rectangle. See `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` for an immutable 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 constructors |
|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#MutableBox()()` Constructs a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` without any initial data. | Cmn |

| ### Public functions |
|---|---|---|
| `open operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#equals(kotlin.Any)(other: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html?)` | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#hashCode()()` | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFrom(androidx.ink.geometry.Box)(input: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box)` Fills this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` with the same values contained in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFrom(androidx.ink.geometry.Box)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)( center: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec, width: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, height: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html )` Constructs a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` with a given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromTwoPoints(androidx.ink.geometry.Vec,androidx.ink.geometry.Vec)(point1: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec, point2: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)` Constructs the smallest `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` containing the two given points. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#setXBounds(kotlin.Float,kotlin.Float)(x1: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, x2: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the lower and upper bounds in the `X` direction to new values. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#setYBounds(kotlin.Float,kotlin.Float)(y1: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, y2: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)` Sets the lower and upper bounds in the `Y` direction to new values. | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#toImmutable()()` Returns an immutable copy of this object. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#toString()()` | Cmn |

| ### Public properties |
|---|---|---|
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#xMax()` The upper bound in the `X` direction. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#xMin()` The lower bound in the `X` direction. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#yMax()` The upper bound in the `Y` direction. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#yMin()` The lower bound in the `Y` direction. | Cmn |

### Inherited functions

From [androidx.ink.geometry.Box](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box) `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCenter()()`

Returns the center of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box`.
Cmn `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCenter(androidx.ink.geometry.MutableVec)(outVec: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec)`

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCenter(androidx.ink.geometry.MutableVec)` with the center of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box`, and returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCenter(androidx.ink.geometry.MutableVec)`.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html<https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableVec>` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCorners()()`

Returns a list containing the 4 corners of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box`.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#computeCorners(androidx.ink.geometry.MutableVec,androidx.ink.geometry.MutableVec,androidx.ink.geometry.MutableVec,androidx.ink.geometry.MutableVec)(
outVecXMinYMin: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec,
outVecXMaxYMin: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec,
outVecXMaxYMax: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec,
outVecXMinYMax: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec
)`

Populates the 4 output points with the corners of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box`.
Cmn `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#contains(androidx.ink.geometry.Box)(otherBox: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box)`

Returns whether the other Box is contained within this Box.
Cmn `operator https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#contains(androidx.ink.geometry.Vec)(point: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Vec)`

Returns whether the given point is contained within the Box.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#isAlmostEqual(androidx.ink.geometry.Box,kotlin.Float)(other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box, tolerance: @https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html)`

Compares this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box` with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#isAlmostEqual(androidx.ink.geometry.Box,kotlin.Float)`, and returns true if the difference between `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#xMin()` from `this` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#xMin()` from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#isAlmostEqual(androidx.ink.geometry.Box,kotlin.Float)` is less than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#isAlmostEqual(androidx.ink.geometry.Box,kotlin.Float)`, and likewise for `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#xMax()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#yMin()`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#yMax()`.
Cmn

### Inherited properties

From [androidx.ink.geometry.Box](https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box) `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#height()`

The height of the rectangle.
Cmn `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box#width()`

The width of the rectangle.
Cmn

## Public constructors

### MutableBox

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
MutableBox()
```

Constructs a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` without any initial data. Fill with the appropriate setters or factory functions.

## Public functions

### equals

Cmn

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

### hashCode

Cmn

```
open fun hashCode(): Int
```

### populateFrom

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun populateFrom(input: Box): MutableBox
```

Fills this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` with the same values contained in `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFrom(androidx.ink.geometry.Box)`.

### populateFromCenterAndDimensions

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun populateFromCenterAndDimensions(
    center: Vec,
    width: @FloatRange(from = 0.0) Float,
    height: @FloatRange(from = 0.0) Float
): MutableBox
```

Constructs a `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` with a given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`. `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox#populateFromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)` must be non-negative numbers.

### populateFromTwoPoints

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun populateFromTwoPoints(point1: Vec, point2: Vec): MutableBox
```

Constructs the smallest `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableBox` containing the two given points.

### setXBounds

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun setXBounds(x1: Float, x2: Float): MutableBox
```

Sets the lower and upper bounds in the `X` direction to new values. The minimum value becomes `xMin`, and the maximum value becomes `xMax`. Returns the same instance to chain function calls.

### setYBounds

Cmn Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

```
fun setYBounds(y1: Float, y2: Float): MutableBox
```

Sets the lower and upper bounds in the `Y` direction to new values. The minimum value becomes `yMin`, and the maximum value becomes `yMax`. Returns the same instance to chain function calls.

### toImmutable

Cmn

```
open fun toImmutable(): ImmutableBox
```

Returns an immutable copy of this object. This will return itself if called on an immutable instance.

### toString

Cmn

```
open fun toString(): String
```

## Public properties

### xMax

Cmn

```
open val xMax: Float
```

The upper bound in the `X` direction.

### xMin

Cmn

```
open val xMin: Float
```

The lower bound in the `X` direction.

### yMax

Cmn

```
open val yMax: Float
```

The upper bound in the `Y` direction.

### yMin

Cmn

```
open val yMin: Float
```

The lower bound in the `Y` direction.