# RoadSample

> Talos 0.6 · Since 0.6

One point on a road's centre line: what {@link RoadLine.at} returns.

## Signature

```ts
export interface RoadSample {
  /** Distance along the road, metres (wrapped into `[0, length)` on a closed road, clamped on an open one). */
  s: number
  /** Centre of the road surface here, world-less: in the road entity's own frame. */
  pos: Vec3
  /** Unit vector along the direction of travel. */
  tangent: Vec3
  /** Unit vector up from the surface, banking included. */
  up: Vec3
  /** Unit vector to the right of the direction of travel: `tangent x up`. */
  right: Vec3
  /** 1/m in the ground plane; positive turning right, negative turning left. */
  curvature: number
  /** Half the road width here, metres (the kerbs are outside it). */
  halfWidth: number
  /** Roll about the tangent, radians; positive lowers the right edge. */
  bank: number
}
```

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

## Members

| Member | Signature | Description |
|---|---|---|
| `s` | `s: number` | Distance along the road, metres (wrapped into `[0, length)` on a closed road, clamped on an open one). |
| `pos` | `pos: Vec3` | Centre of the road surface here, world-less: in the road entity's own frame. |
| `tangent` | `tangent: Vec3` | Unit vector along the direction of travel. |
| `up` | `up: Vec3` | Unit vector up from the surface, banking included. |
| `right` | `right: Vec3` | Unit vector to the right of the direction of travel: `tangent x up`. |
| `curvature` | `curvature: number` | 1/m in the ground plane; positive turning right, negative turning left. |
| `halfWidth` | `halfWidth: number` | Half the road width here, metres (the kerbs are outside it). |
| `bank` | `bank: number` | Roll about the tangent, radians; positive lowers the right edge. |

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