Description
Normalize coordinate around origin, round to the nearest grid index, resolve exact half steps by the selected policy, and return index and snapped coordinate.
A layout divides finite space among content, margins, gutters, and clearances. Counts describe how many gaps exist, while offsets and snapping describe where edges fall; changing either convention changes the resulting dimensions.
Normalize coordinate around origin, round to the nearest grid index, resolve exact half steps by the selected policy, and return index and snapped coordinate.
When to use this tool
Use Baseline Grid Half Step Rule when you need a local layout dimension or alignment check with explicit geometric inputs.
How to use the tool and how it works
- Enter coordinate, origin, step, tiePolicy. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read gridIndex, snapped. Use the output convention below.
Require positive step and tiePolicy lower, upper, or even. Normalize coordinate around origin, round to the nearest grid index, resolve exact half steps by the selected policy, and return index and snapped coordinate.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| coordinate | Coordinate | Required. Finite number. |
| origin | Grid origin coordinate in the same length unit as coordinate and step. | Required. Finite number. |
| step | Step | Required. Finite number; strictly above 0. |
| tiePolicy | Tie Policy | Required. Text; one of "lower", "upper", "even"; maximum UTF-16 length 8192. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| gridIndex | Grid Index | Required. Safe integer. |
| snapped | Snapped | Required. Finite number. |
{
"input": {
"coordinate": 5,
"origin": 0,
"step": 2,
"tiePolicy": "even"
},
"output": {
"gridIndex": 2,
"snapped": 4
}
} Limitations and assumptions
- Half-step equality is exact binary arithmetic; negative indexes are allowed and even refers to the index rather than a visually even pixel coordinate.
- Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.
- Numeric calculations use binary floating point unless exact decimal-integer arithmetic is explicitly stated. No hidden measurement tolerance or decimal rounding is added; nonfinite or out-of-contract results are rejected. Numeric signed-zero results are exported as zero.
Alternative or Complementary methods
Construct the full layout in a design application and inspect its bounds. For overlapping or rotated content, use geometric intersection and containment rather than independent one-dimensional allowances.
References
Similar or alternative tools
- Baseline Grid Phase Offset
Reduce baseline-origin modulo step into [0, step) and divide by step for fraction.
- Grid Gutter Per Column Share
Divide nonnegative gutterWidth by positive columnWidth.