# gizlang/bvh

Biovision Hierarchy motion files (BVH, as motion capture libraries give them): a skeleton of joints with their offsets and channels, then one line of channel values a frame.

```gizlang
import * as Bvh from "gizlang/bvh";
```

## Types

### `Motion`

```gizlang
type Motion = { names: Vec<string>; parents: Vec<i64>; offsets: Vec<Point3>; ends: Vec<Point3>; channels: Vec<Vec<string>>; first: Vec<i64>; width: i64; values: Vec<f64>; frames: i64; seconds: f64; }
```

A motion: each joint's name, parent (-1: the root; parents come first), offset from its parent and end offset (an
End Site's, else 0, 0, 0), its channels (Xposition .. Zrotation, in the file's order) and the first of its values
in a frame; the frames' values and the seconds a frame lasts.

- `names`: `Vec<string>`
- `parents`: `Vec<i64>`
- `offsets`: `Vec<gizlang_geometry.Point3>`
- `ends`: `Vec<gizlang_geometry.Point3>`
- `channels`: `Vec<Vec<string>>`
- `first`: `Vec<i64>`
- `width`: `i64`
- `values`: `Vec<f64>`
- `frames`: `i64`
- `seconds`: `f64`

### `Pose`

```gizlang
type Pose = { rotations: Vec<Rotation>; root: Point3; }
```

A frame of a motion: each joint's rotation in its parent's frame, and the root's position.

- `rotations`: `Vec<gizlang_geometry.Rotation>`
- `root`: `gizlang_geometry.Point3`

## Functions

### `parse`

```gizlang
function parse(text: string): Motion throws string
```

The motion of BVH text TEXT.

Effects: fail, alloc.

## Methods

### `Motion.pose`

```gizlang
function Motion.pose(self: Motion, f: i64): Pose
```

Frame F of motion M: each channel turns its joint in the file's order (Z then Y then X is R = Rz Ry Rx), in
degrees; the root's position channels set its position (its offset where it has none).

Effects: fail, read, write, console, io, alloc.

