# RoadClosest

> Talos next · Since 0.6

Where a position is relative to a road's centre line: what {@link RoadLine.closest} returns.

## Signature

```ts
export interface RoadClosest {
  /** Distance along the road of the nearest point on the centre line. */
  s: number
  /** Signed sideways distance from the centre line, metres: positive is to the right. */
  offset: number
  /** Straight-line distance to the centre line, metres. */
  distance: number
}
```

Import: `import type { RoadClosest } from "@argus/api"`

## Members

| Member | Signature | Description |
|---|---|---|
| `s` | `s: number` | Distance along the road of the nearest point on the centre line. |
| `offset` | `offset: number` | Signed sideways distance from the centre line, metres: positive is to the right. |
| `distance` | `distance: number` | Straight-line distance to the centre line, metres. |

## Example

The tested fixture `fixtures/app/agent.ts`.

```ts
import type { Behavior } from "@argus/api"

// Sends a nav agent to `props.target` once, then reports arrival through ctx.state so the
// test can read it without polling the crowd directly.
export default {
  init(ctx) {
    ctx.state.arrived = false
    ctx.nav?.goTo(ctx.props.target as [number, number, number])
  },
  update(ctx) {
    if (ctx.nav?.arrived) ctx.state.arrived = true
  },
} satisfies Behavior
```
