Grid Serpentine Index Map
Map serpentine traversal positions to row-major source indexes, reversing odd rows while retaining the first row direction.
Description
Map serpentine traversal positions to row-major source indexes, reversing odd rows while retaining the first row direction.
Serpentine traversal alternates row direction while retaining row-major source addresses.
When to use this tool
Map serpentine traversal positions to row-major source indexes, reversing odd rows while retaining the first row direction.
- Prepare the supplied rows, columns fields for this operation.
- Compare the complete example with the representation used by your own input before carrying the result into another step.
How to use the tool and how it works
- Enter rows, columns. Use the exact text syntax, units and index conventions explained below.
- Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
- Read result.sourceIndexes. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
For rows/columns from 1 to 128, enumerate row-major output positions. Use the same column on even rows and columns-1-column on odd rows, returning each corresponding source linear index.1
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| rows | rows. | Integer from 1 to 128 inclusive |
| columns | columns. | Integer from 1 to 128 inclusive |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.sourceIndexes | Original input positions of the retained or selected records, under the ordering described above. |
{
"input": {
"rows": 2,
"columns": 3
},
"output": {
"result": {
"sourceIndexes": [
0,
1,
2,
5,
4,
3
]
}
}
} Limitations and assumptions
- The result is an index map, not reordered grid content. Traversal begins left-to-right in row zero.
- Coordinate pairs use [row,column] where stated. Masks are nonempty rectangular zero/one matrices of at most 128 rows, 128 columns and 16,384 cells; outside-mask values are unset for the neighborhood operations.
- Every declared top-level field is required and unexpected fields are rejected. Numeric inputs must be finite; ordinary text fields are bounded to 8,192 UTF-16 code units, with tighter operation-specific limits where stated.
- String lists have at most 128 entries of at most 128 code units; matrices have at most 128 rows and columns. Larger numeric lists and parsed JSON have separate bounded budgets. Nonfinite results and excessively large serialized outputs are rejected.
- Indexes are zero-based and spans have an exclusive end unless explicitly stated otherwise. A valid false, null or empty-list result is distinct from malformed input.
Alternative or Complementary methods
Keep row/column coordinates distinct from x/y pairs and byte offsets. Select the neighborhood metric, outside-mask rule and storage-order convention explicitly; these operations do not infer an image format.
References
Similar or alternative tools
- Grid Crop Coordinate Map
Map source grid coordinates into a half-open crop and retain excluded-coordinate evidence instead of silently clipping.
- Grid Padding Coordinate Map
Translate source grid coordinates after explicit top/left padding; no inferred original or padded dimensions.