Description
Subtract half each nonnegative stroke width from nonnegative centerlineGap for visibleGap, then subtract requiredVisibleGap for margin.
A vector stroke has width as well as a centerline, and a dashed stroke alternates painted lengths and gaps. Pattern phase and visible clearance depend on these dimensions even before a path is rendered.
Subtract half each nonnegative stroke width from nonnegative centerlineGap for visibleGap, then subtract requiredVisibleGap for margin.
When to use this tool
Use Icon Stroke Clearance Gap when you need a numerical stroke allowance or repeating-pattern calculation before rendering.
How to use the tool and how it works
- Enter centerlineGap, firstStrokeWidth, secondStrokeWidth, requiredVisibleGap. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- Read visibleGap, margin. Use the output convention below.
Subtract half each nonnegative stroke width from nonnegative centerlineGap for visibleGap, then subtract requiredVisibleGap for margin.1
| Input field | Meaning and units | Accepted input |
|---|---|---|
| centerlineGap | Centerline Gap | Required. Finite number; minimum 0. |
| firstStrokeWidth | First Stroke Width | Required. Finite number; minimum 0. |
| secondStrokeWidth | Second Stroke Width | Required. Finite number; minimum 0. |
| requiredVisibleGap | Required Visible Gap | Required. Finite number; minimum 0. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| visibleGap | Visible Gap | Required. Finite number. |
| margin | Signed allowance under the subtraction convention above. | Required. Finite number. |
{
"input": {
"centerlineGap": 10,
"firstStrokeWidth": 4,
"secondStrokeWidth": 2,
"requiredVisibleGap": 5
},
"output": {
"visibleGap": 7,
"margin": 2
}
} Limitations and assumptions
- Lengths share units; negative gaps are retained and this straight-stroke model omits joins, caps, curvature, rasterization, and actual icon geometry.
- 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
Inspect the result in the target vector renderer at final size. Curved paths, joins, caps, and rasterization may require geometry or visual checks beyond a local length calculation.
References
Similar or alternative tools
- Pixel Grid Half Stroke Snap Offset
Convert to device pixels, round the lower stroke edge using Math.round, then add half the device width and convert back for snappedCenter and offset.
- Vector Stroke Dash Period Remainder
Duplicate an odd-length array, sum the effective array as period, and normalize signed offset into [0, period).