The Geometry APIs allow you to create interactive tools such as erasers and selection mechanisms.

To illustrate practical application of the Geometry APIs, explore the following eraser implementation example.

### Whole stroke eraser

    fun eraseWholeStrokes(
        eraserBox: ImmutableBox,
        finishedStrokesState: MutableState<Set<Stroke>>,
    ) {
        val threshold = 0.1f

        val strokesToErase = finishedStrokesState.value.filter { stroke ->
            stroke.shape.computeCoverageIsGreaterThan(
                box = eraserBox,
                coverageThreshold = threshold,
            )
        }
        if (strokesToErase.isNotEmpty()) {
            Snapshot.withMutableSnapshot {
                finishedStrokesState.value -= strokesToErase
            }
        }
    }

For a Compose implementation, make sure to trigger a recomposition, so the strokes are effectively removed. For example, an approach would be to use`rememberCoroutineScope`in your composable and pass the coroutine scope to your touch listener, allowing you to modify`finishedStrokesState`within the scope of Compose.
| **Note:** An eraser that only removes the parts of the strokes it touches can be implemented by seeing if a stroke intersects with individual line segments of a[`StrokeInputBatch`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch)and creating new[`StrokeInputBatch`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/StrokeInputBatch)and[`Stroke`](https://developer.android.com/reference/kotlin/androidx/ink/strokes/Stroke)objects out of the line segments that aren't intersected.