Skip to content

Main content

Baseline Grid Half Step Rule Tool

Nearest baseline-grid coordinate with an explicit half-step lower, upper or even-index policy.

Loading tool…

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

  1. Enter coordinate, origin, step, tiePolicy. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. 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 fieldMeaning and unitsAccepted input
coordinateCoordinateRequired. Finite number.
originGrid origin coordinate in the same length unit as coordinate and step.Required. Finite number.
stepStepRequired. Finite number; strictly above 0.
tiePolicyTie PolicyRequired. Text; one of "lower", "upper", "even"; maximum UTF-16 length 8192.
Output fieldInterpretationReturned shape
gridIndexGrid IndexRequired. Safe integer.
snappedSnappedRequired. Finite number.
json
{
  "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

  1. Calculation and input contract: graphic-design/baseline-grid-half-step-rule — tool.io

Similar or alternative tools