# ImmutableBox

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/ImmutableBox.kt+class:androidx.ink.geometry.ImmutableBox) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/ink#1.0.0)

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class ImmutableBox : 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.ImmutableBox](https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox) |

*** ** * ** ***

An immutable axis-aligned rectangle. See `https://developer.android.com/reference/kotlin/androidx/ink/geometry/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

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion` |

| ### Public companion functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox#fromCenterAndDimensions(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 an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` with a given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox#fromTwoPoints(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/ImmutableBox` containing the two given points. | 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/ImmutableBox#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/ImmutableBox#hashCode()()` | Cmn |
| `open https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox#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/ImmutableBox#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/ImmutableBox#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/ImmutableBox#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/ImmutableBox#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/ImmutableBox#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 companion functions

### fromCenterAndDimensions

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

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

Constructs an `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox` with a given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/ImmutableBox.Companion#fromCenterAndDimensions(androidx.ink.geometry.Vec,kotlin.Float,kotlin.Float)`.

### fromTwoPoints

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

```
fun fromTwoPoints(point1: Vec, point2: Vec): ImmutableBox
```

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

## Public functions

### equals

Cmn

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

### hashCode

Cmn

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

### 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.