---
title: "PathHitTester"
description: "Creates a new [PathHitTester] to query whether certain x/y coordinates lie inside a given [Path].
A [PathHitTester] is optimized to perform multiple queries against a single path.

The result of a query depends on the [fill type][Path.fillType] of the path.

If the content of [path] changes, you must call [PathHitTester.updatePath] or create a new
[PathHitTester] as [PathHitTester] will cache precomputed values to speed up queries.

If [path] contains conic curves, they are converted to quadratic curves during the query process.
The tolerance of that conversion is defined by [tolerance]. The tolerance should be appropriate
to the coordinate systems used by the caller. For instance if the path is defined in pixels, 0.5
(half a pixel) or 1.0 (a pixel) are appropriate tolerances. If the path is normalized and defined
in the domain 0..1, the caller should choose a more appropriate tolerance close to or equal to
one \"query unit\". The tolerance must be >= 0."
type: "function"
---

<div class='type'>Function</div>


<a id='references'></a>
<div class='sourceset sourceset-common'>Common</div>


```kotlin
fun PathHitTester(path: Path, @FloatRange(from = 0.0) tolerance: Float = 0.5f) =
    PathHitTester().apply { updatePath(path, tolerance) }
```


Creates a new `PathHitTester` to query whether certain x/y coordinates lie inside a given `Path`.
A `PathHitTester` is optimized to perform multiple queries against a single path.

The result of a query depends on the `fill type` of the path.

If the content of `path` changes, you must call `PathHitTester.updatePath` or create a new
`PathHitTester` as `PathHitTester` will cache precomputed values to speed up queries.

If `path` contains conic curves, they are converted to quadratic curves during the query process.
The tolerance of that conversion is defined by `tolerance`. The tolerance should be appropriate
to the coordinate systems used by the caller. For instance if the path is defined in pixels, 0.5
(half a pixel) or 1.0 (a pixel) are appropriate tolerances. If the path is normalized and defined
in the domain 0..1, the caller should choose a more appropriate tolerance close to or equal to
one "query unit". The tolerance must be >= 0.

#### Parameters

| | |
| --- | --- |
| path | The `Path` to run queries against. |
| tolerance | When `path` contains conic curves, defines the maximum distance between the original conic curve and its quadratic approximations. Set to 0.5 by default. |




