# PartitionedMesh

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

*** ** * ** ***

Common/AllAndroid/JVMNative/C/iOS
- Cmn

  ```
  class PartitionedMesh
  ```

*** ** * ** ***

An immutable\*\* complex shape expressed as a set of triangles. This is used to represent the shape of a stroke or other complex objects. The mesh may be divided into multiple partitions, which enables certain brush effects (e.g. "multi-coat"), and allows ink to create strokes using greater than 2\^16 triangles (which must be rendered in multiple passes).

A `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` may optionally have one or more "outlines", which are polylines that traverse some or all of the vertices in the mesh; these are used for path-based rendering of strokes. This supports disjoint meshes such as dashed lines.

`https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` provides fast intersection and coverage testing by use of an internal spatial index.

\*\* `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is technically not immutable, as the spatial index is lazily instantiated; however, from the perspective of a caller, its properties do not change over the course of its lifetime. The entire object is thread-safe.

## Summary

| ### Nested types |
|---|
| `object https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh.Companion` Declared as a target for extension functions. |

| ### Public functions |
|---|---|---|
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box?` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeBoundingBox()()` Returns the minimum bounding box of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)(box: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box, boxToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform)` Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.PartitionedMesh,androidx.ink.geometry.AffineTransform)( other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh, otherShapeToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)( parallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram, parallelogramToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/FloatRange(from = 0.0, to = 1.0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)(triangle: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle, triangleToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform)` Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)( box: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Box, coverageThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, boxToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.PartitionedMesh,kotlin.Float,androidx.ink.geometry.AffineTransform)( other: https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh, coverageThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, otherShapeToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Returns true if the approximate portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.PartitionedMesh,kotlin.Float,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)( parallelogram: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Parallelogram, coverageThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, parallelogramToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)( triangle: https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle, coverageThreshold: https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-float/index.html, triangleToThis: https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform )` Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineCount(kotlin.Int)(groupIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns the number of outlines of the mesh for the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineCount(kotlin.Int)`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)( groupIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html )` Returns the number of vertices that are in the outline at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)`. | Cmn |
| `@https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getRenderGroupCount()()` Returns the number of render groups in this mesh. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#initializeSpatialIndex()()` Initializes this MutableEnvelope's spatial index for geometry queries. | Cmn |
| `https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)( groupIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outlineVertexIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, outPosition: https://developer.android.com/reference/kotlin/androidx/ink/geometry/MutableVec )` Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` with the position of the outline vertex at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` in the outline at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`, and returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`. | Cmn |
| `open https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#toString()()` | Cmn |

| ### Extension functions |
|---|---|---|
| `https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh.https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#(androidx.ink.geometry.PartitionedMesh).outlinesToPath(kotlin.Int)(renderGroupIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)` Returns a `https://developer.android.com/reference/android/graphics/Path.html` containing the outlines in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).outlinesToPath(kotlin.Int)`. | android |
| `https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh.https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)( renderGroupIndex: @https://developer.android.com/reference/kotlin/androidx/annotation/IntRange(from = 0) https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html, out: https://developer.android.com/reference/android/graphics/Path.html )` Replaces the contents of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)` with the outline of the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)`. | android |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh.https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#(androidx.ink.geometry.PartitionedMesh).encode()()` Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` to the returned `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`. | Cmn |
| `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh.https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#(androidx.ink.geometry.PartitionedMesh).encode(java.io.OutputStream)(output: https://developer.android.com/reference/java/io/OutputStream.html)` Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` to the given `https://developer.android.com/reference/java/io/OutputStream.html`. | android |

## Public functions

### computeBoundingBox

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

```
fun computeBoundingBox(): Box?
```

Returns the minimum bounding box of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`. This will be null if the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is empty.

### computeCoverage

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

```
fun computeCoverage(
    box: Box,
    boxToThis: AffineTransform = AffineTransform.IDENTITY
): @FloatRange(from = 0.0, to = 1.0) Float
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)`. This is calculated by finding the sum of areas of the triangles that intersect the given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)`, and dividing that by the sum of the areas of all triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` that overlap each other (e.g. in the case of a stroke that loops back over itself) are counted individually. Note that, if any triangles have negative area (due to winding, see `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Box,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverage

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

```
fun computeCoverage(
    other: PartitionedMesh,
    otherShapeToThis: AffineTransform = AffineTransform.IDENTITY
): @FloatRange(from = 0.0, to = 1.0) Float
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`. This is calculated by finding the sum of areas of the triangles that intersect `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.PartitionedMesh,androidx.ink.geometry.AffineTransform)`, and dividing that by the sum of the areas of all triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` that overlap each other (e.g. in the case of a stroke that loops back over itself) are counted individually. Note that, if any triangles have negative area (due to winding, see `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.PartitionedMesh,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.PartitionedMesh,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverage

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

```
fun computeCoverage(
    parallelogram: Parallelogram,
    parallelogramToThis: AffineTransform = AffineTransform.IDENTITY
): @FloatRange(from = 0.0, to = 1.0) Float
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)`. This is calculated by finding the sum of areas of the triangles that intersect the given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)`, and dividing that by the sum of the areas of all triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` that overlap each other (e.g. in the case of a stroke that loops back over itself) are counted individually. Note that, if any triangles have negative area (due to winding, see `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Parallelogram,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverage

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

```
fun computeCoverage(
    triangle: Triangle,
    triangleToThis: AffineTransform = AffineTransform.IDENTITY
): @FloatRange(from = 0.0, to = 1.0) Float
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)`. This is calculated by finding the sum of areas of the triangles that intersect the given `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)`, and dividing that by the sum of the areas of all triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` that overlap each other (e.g. in the case of a stroke that loops back over itself) are counted individually. Note that, if any triangles have negative area (due to winding, see `https://developer.android.com/reference/kotlin/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverage(androidx.ink.geometry.Triangle,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
fun computeCoverageIsGreaterThan(
    box: Box,
    coverageThreshold: Float,
    boxToThis: AffineTransform = AffineTransform.IDENTITY
): Boolean
```

Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)`.

This is equivalent to:

```kotlin
computeCoverage(box, boxToThis) > coverageThreshold
```

but may be faster.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Box,kotlin.Float,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
fun computeCoverageIsGreaterThan(
    other: PartitionedMesh,
    coverageThreshold: Float,
    otherShapeToThis: AffineTransform = AffineTransform.IDENTITY
): Boolean
```

Returns true if the approximate portion of this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.PartitionedMesh,kotlin.Float,androidx.ink.geometry.AffineTransform)`.

This is equivalent to:

```kotlin
computeCoverage(other, otherShapeToThis) > coverageThreshold
```

but may be faster.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.PartitionedMesh,kotlin.Float,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.PartitionedMesh,kotlin.Float,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
fun computeCoverageIsGreaterThan(
    parallelogram: Parallelogram,
    coverageThreshold: Float,
    parallelogramToThis: AffineTransform = AffineTransform.IDENTITY
): Boolean
```

Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)`.

This is equivalent to:

```kotlin
computeCoverage(parallelogram, parallelogramToThis) > coverageThreshold
```

but may be faster.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Parallelogram,kotlin.Float,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
fun computeCoverageIsGreaterThan(
    triangle: Triangle,
    coverageThreshold: Float,
    triangleToThis: AffineTransform = AffineTransform.IDENTITY
): Boolean
```

Returns true if the approximate portion of the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` covered by `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)` is greater than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)`.

This is equivalent to:

```kotlin
computeCoverage(triangle, triangleToThis) > coverageThreshold
```

but may be faster.

On an empty `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`, this will always return 0.

Optional argument `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)` contains the transform that maps from `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#computeCoverageIsGreaterThan(androidx.ink.geometry.Triangle,kotlin.Float,androidx.ink.geometry.AffineTransform)`'s coordinate space to this `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/kotlin/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### getOutlineCount

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

```
fun getOutlineCount(groupIndex: @IntRange(from = 0) Int): @IntRange(from = 0) Int
```

Returns the number of outlines of the mesh for the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineCount(kotlin.Int)`.

Groups with discontinuous geometry will always have multiple outlines, but even continuous geometry may be drawn with multiple overlapping outlines when this improves rendering quality or performance.

### getOutlineVertexCount

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

```
fun getOutlineVertexCount(
    groupIndex: @IntRange(from = 0) Int,
    outlineIndex: @IntRange(from = 0) Int
): @IntRange(from = 0) Int
```

Returns the number of vertices that are in the outline at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)`.

### getRenderGroupCount

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

```
fun getRenderGroupCount(): @IntRange(from = 0) Int
```

Returns the number of render groups in this mesh. Each outline in the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` belongs to exactly one render group, which are numbered in z-order: the group with index zero should be rendered on bottom; the group with the highest index should be rendered on top.

### initializeSpatialIndex

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

```
fun initializeSpatialIndex(): Unit
```

Initializes this MutableEnvelope's spatial index for geometry queries. If a geometry query is made with this shape and the spatial index is not currently initialized, it will be initialized in real time to satisfy that query.

### populateOutlinePosition

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

```
fun populateOutlinePosition(
    groupIndex: @IntRange(from = 0) Int,
    outlineIndex: @IntRange(from = 0) Int,
    outlineVertexIndex: @IntRange(from = 0) Int,
    outPosition: MutableVec
): MutableVec
```

Populates `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` with the position of the outline vertex at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` in the outline at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`, and returns `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`. `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getRenderGroupCount()`, `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` for `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`, and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less than `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` for `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` and `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`.

### toString

Cmn

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

## Extension functions

### PartitionedMesh.outlinesToPath

android 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/AndroidGraphicsConversionExtensions.android.kt+function:outlinesToPath)

```
fun PartitionedMesh.outlinesToPath(renderGroupIndex: @IntRange(from = 0) Int): Path
```

Returns a `https://developer.android.com/reference/android/graphics/Path.html` containing the outlines in the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).outlinesToPath(kotlin.Int)`.

### PartitionedMesh.populateOutlines

android 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/AndroidGraphicsConversionExtensions.android.kt+function:populateOutlines)

```
fun PartitionedMesh.populateOutlines(
    renderGroupIndex: @IntRange(from = 0) Int,
    out: Path
): Path
```

Replaces the contents of `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)` with the outline of the render group at `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)`.

Returns the modified `https://developer.android.com/reference/android/graphics/Path.html` to allow chaining calls.

| Returns |
|---|---|
| `https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/kotlin/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)` |

### PartitionedMesh.encode

Cmn Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/PartitionedMeshExtensions.kt+function:encode)

```
fun PartitionedMesh.encode(): ByteArray
```

Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` to the returned `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-byte-array/index.html`.

### PartitionedMesh.encode

android Artifact: [androidx.ink:ink-storage](https://developer.android.com/jetpack/androidx/releases/ink) [View Source](https://cs.android.com/search?q=file:androidx/ink/storage/PartitionedMeshExtensions.jvmAndAndroid.kt+function:encode)

```
fun PartitionedMesh.encode(output: OutputStream): Unit
```

Write a gzip-compressed `ink.proto.CodedModeledShape` binary proto message representing the `https://developer.android.com/reference/kotlin/androidx/ink/geometry/PartitionedMesh` to the given `https://developer.android.com/reference/java/io/OutputStream.html`.