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

*** ** * ** ***


```
public final class PartitionedMesh
```

<br />

*** ** * ** ***

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/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/androidx/ink/geometry/PartitionedMesh` provides fast intersection and coverage testing by use of an internal spatial index.

\*\* `https://developer.android.com/reference/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 |
|---|
| `public static class https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh.Companion` Declared as a target for extension functions. |

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

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

## Public methods

### computeBoundingBox

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

```
public final Box computeBoundingBox()
```

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

### computeCoverage

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

```
public final @FloatRange(from = 0.0, to = 1.0) float computeCoverage(@NonNull Box box, @NonNull AffineTransform boxToThis)
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/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/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

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

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

### computeCoverage

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

```
public final @FloatRange(from = 0.0, to = 1.0) float computeCoverage(
    @NonNull PartitionedMesh other,
    @NonNull AffineTransform otherShapeToThis
)
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`. This is calculated by finding the sum of areas of the triangles that intersect `https://developer.android.com/reference/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/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/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/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

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

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

### computeCoverage

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

```
public final @FloatRange(from = 0.0, to = 1.0) float computeCoverage(
    @NonNull Parallelogram parallelogram,
    @NonNull AffineTransform parallelogramToThis
)
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/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/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

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

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

### computeCoverage

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

```
public final @FloatRange(from = 0.0, to = 1.0) float computeCoverage(
    @NonNull Triangle triangle,
    @NonNull AffineTransform triangleToThis
)
```

Computes an approximate measure of what portion of this `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh` is covered by or overlaps with `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`, all in the `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh`'s coordinate space. Triangles in the `https://developer.android.com/reference/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/androidx/ink/geometry/Triangle#computeSignedArea()`), the absolute value of their area will be used instead.

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

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

### computeCoverageIsGreaterThan

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

```
public final boolean computeCoverageIsGreaterThan(
    @NonNull Box box,
    float coverageThreshold,
    @NonNull AffineTransform boxToThis
)
```

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

This is equivalent to:

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

but may be faster.

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

Optional argument `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
public final boolean computeCoverageIsGreaterThan(
    @NonNull PartitionedMesh other,
    float coverageThreshold,
    @NonNull AffineTransform otherShapeToThis
)
```

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

This is equivalent to:

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

but may be faster.

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

Optional argument `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
public final boolean computeCoverageIsGreaterThan(
    @NonNull Parallelogram parallelogram,
    float coverageThreshold,
    @NonNull AffineTransform parallelogramToThis
)
```

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

This is equivalent to:

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

but may be faster.

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

Optional argument `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### computeCoverageIsGreaterThan

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

```
public final boolean computeCoverageIsGreaterThan(
    @NonNull Triangle triangle,
    float coverageThreshold,
    @NonNull AffineTransform triangleToThis
)
```

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

This is equivalent to:

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

but may be faster.

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

Optional argument `https://developer.android.com/reference/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/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/androidx/ink/geometry/PartitionedMesh`'s coordinate space, which defaults to `https://developer.android.com/reference/androidx/ink/geometry/AffineTransform#IDENTITY()`.

### getOutlineCount

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

```
public final @IntRange(from = 0) int getOutlineCount(@IntRange(from = 0) int groupIndex)
```

Returns the number of outlines of the mesh for the render group at `https://developer.android.com/reference/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

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

```
public final @IntRange(from = 0) int getOutlineVertexCount(
    @IntRange(from = 0) int groupIndex,
    @IntRange(from = 0) int outlineIndex
)
```

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

### getRenderGroupCount

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

```
public final @IntRange(from = 0) int getRenderGroupCount()
```

Returns the number of render groups in this mesh. Each outline in the `https://developer.android.com/reference/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

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

```
public final void initializeSpatialIndex()
```

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

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

```
public final @NonNull MutableVec populateOutlinePosition(
    @IntRange(from = 0) int groupIndex,
    @IntRange(from = 0) int outlineIndex,
    @IntRange(from = 0) int outlineVertexIndex,
    @NonNull MutableVec outPosition
)
```

Populates `https://developer.android.com/reference/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/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` in the outline at `https://developer.android.com/reference/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/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`, and returns `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`. `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less than `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#getRenderGroupCount()`, `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` for `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`, and `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` must be less than `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#getOutlineVertexCount(kotlin.Int,kotlin.Int)` for `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)` and `https://developer.android.com/reference/androidx/ink/geometry/PartitionedMesh#populateOutlinePosition(kotlin.Int,kotlin.Int,kotlin.Int,androidx.ink.geometry.MutableVec)`.

### toString

```
public @NonNull String toString()
```

## Extension functions

### AndroidGraphicsConverter.outlinesToPath

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)

```
public final @NonNull Path AndroidGraphicsConverter.outlinesToPath(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex
)
```

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

### AndroidGraphicsConverter.populateOutlines

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)

```
public final @NonNull Path AndroidGraphicsConverter.populateOutlines(
    @NonNull PartitionedMesh receiver,
    @IntRange(from = 0) int renderGroupIndex,
    @NonNull Path out
)
```

Replaces the contents of `https://developer.android.com/reference/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/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/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Path.html` | `https://developer.android.com/reference/androidx/ink/geometry/package-summary#(androidx.ink.geometry.PartitionedMesh).populateOutlines(kotlin.Int,android.graphics.Path)` |

### PartitionedMeshExtensions.encode

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)

```
public final @NonNull byte[] PartitionedMeshExtensions.encode(@NonNull PartitionedMesh receiver)
```

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

### PartitionedMeshExtensions.encode

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)

```
public final void PartitionedMeshExtensions.encode(
    @NonNull PartitionedMesh receiver,
    @NonNull OutputStream output
)
```

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