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

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


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
class PathHitTester
```


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


## Functions

```kotlin
fun updatePath(path: Path, @FloatRange(from = 0.0) tolerance: Float = 0.5f)
```


Sets the `Path` to run queries against.

If `path` contains conic curves, they are converted to quadratic curves during the query
process. This value defines the tolerance of that conversion.

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



```kotlin
operator fun contains(position: Offset): Boolean
```


Queries whether the specified `position` is inside this `Path`. The
`path's fill type` is taken into account to determine if the point lies inside
this path or not.

#### Parameters

| | |
| --- | --- |
| position | The x/y coordinates of the point to test. |


#### Returns

| | |
| --- | --- |
|  | True if `position` is inside this path, false otherwise. |




