Next: , Previous: , Up: SPV Light Detail Member Format   [Contents][Index]


D.2.12 Data

The final part of an SPV light member contains the actual data.

Data ⇒
    int[layers] int[rows] int[columns] int*[n-dimensions]
    int[n-data] Datum*[n-data]
Datum ⇒ int64[index] v1(00?) Value

The values of n-layers, n-rows, and n-columns each specifies the number of dimensions displayed in layers, rows, and columns, respectively. Any of them may be zero. Their values sum to n-dimensions from Dimensions (see SPV Light Member Dimensions).

The n-dimensions integers are a permutation of the 0-based dimension numbers. The first n-layers integers specify each of the dimensions represented by layers, the next n-rows integers specify the dimensions represented by rows, and the final n-columns integers specify the dimensions represented by columns. When there is more than one dimension of a given kind, the inner dimensions are given first.

The format of a Datum varies slightly from version 1 to version 3: in version 1 it allows for an extra optional 00 byte.

A Datum consists of an index and a Value. Suppose there are d dimensions and dimension i, 0 \le i < d, has n_i categories. Consider the datum at coordinates x_i, 0 \le i < d, and note that 0 \le x_i < n_i. Then the index is calculated by the following algorithm:

let index = 0
for each i from 0 to d - 1:
    index = (n_i \times index) + x_i

For example, suppose there are 3 dimensions with 3, 4, and 5 categories, respectively. The datum at coordinates (1, 2, 3) has index 5 \times (4 \times (3 \times 0 + 1) + 2) + 3 = 33. Within a given dimension, the index is the cat-index in a Leaf.


Next: , Previous: , Up: SPV Light Detail Member Format   [Contents][Index]