LayerData.idxToRow

get the row corresponding to a position in the data or objects array.

struct LayerData
@property
idxToRow
(
size_t idx
)

Examples

1 LayerData layer;
2 layer.numCols = 3;
3 layer.numRows = 2;
4 
5 assert(layer.idxToRow(0) == 0);
6 assert(layer.idxToRow(1) == 0);
7 assert(layer.idxToRow(2) == 0);
8 assert(layer.idxToRow(3) == 1);
9 assert(layer.idxToRow(4) == 1);
10 assert(layer.idxToRow(5) == 1);

Meta