# DataTable

Class

Source: https://github.com/playcanvas/splat-transform/blob/b6424a5b3b929695fbaafe738a995adb1240d675/src/lib/data-table/data-table.ts#L94

A table of columnar data representing Gaussian splat properties.

DataTable is the core data structure for splat data. Each column represents
a property (e.g., position, rotation, color) as a typed array, and all columns
must have the same number of rows.

Standard columns include:
- Position: `x`, `y`, `z`
- Rotation: `rot_0`, `rot_1`, `rot_2`, `rot_3` (quaternion)
- Scale: `scale_0`, `scale_1`, `scale_2` (log scale)
- Color: `f_dc_0`, `f_dc_1`, `f_dc_2` (spherical harmonics DC)
- Opacity: `opacity` (logit)
- Spherical Harmonics: `f_rest_0` through `f_rest_44`

**Example**

```ts
const table = new DataTable([
    new Column('x', new Float32Array([0, 1, 2])),
    new Column('y', new Float32Array([0, 0, 0])),
    new Column('z', new Float32Array([0, 0, 0]))
]);
console.log(table.numRows);    // 3
console.log(table.numColumns); // 3
```

## Methods

### clone

```ts
clone(options?: object): DataTable
```

Creates a copy of this DataTable, optionally selecting specific rows and/or columns.

**Parameters**

- `options` (`object`, optional): Optional selection criteria.
    - `options.columns` (`string[]`, optional): Column names to include. If omitted, all columns are copied.
    - `options.rows` (`Uint32Array<ArrayBufferLike> | number[]`, optional): Row indices to include (and their order). If omitted, all rows are copied.

**Returns** [`DataTable`](https://api.playcanvas.com/splat-transform/classes/DataTable.md): A new DataTable with copied data.

**Example**

```ts
const full = table.clone();
const subset = table.clone({ rows: [0, 2, 4], columns: ['x', 'y', 'z'] });
```

### permuteRowsInPlace

```ts
permuteRowsInPlace(indices: Uint32Array<ArrayBufferLike> | number[]): void
```

Permutes the rows of this DataTable in-place according to the given indices.
After calling, row `i` will contain the data that was previously at row `indices[i]`.

This is a memory-efficient alternative to `clone({ rows })` that modifies the table
in-place rather than creating a copy. It reuses ArrayBuffers between columns to
minimize memory allocations.

**Parameters**

- `indices` (`Uint32Array<ArrayBufferLike> | number[]`): Array of indices defining the permutation. Must have the same
  length as the number of rows, and must be a valid permutation
  (each index 0 to n-1 appears exactly once).
