Line Cap Extension Budget
Compute ideal axial line-cap extension budget for straight segments; round caps are not rectangular area bounds and joins are outside scope.
Description
Compute ideal axial line-cap extension budget for straight segments; round caps are not rectangular area bounds and joins are outside scope.
Stroke caps extend a straight segment axially by different amounts. The budget is separate from full stroke-outline geometry.1
When to use this tool
Compute ideal axial line-cap extension budget for straight segments; round caps are not rectangular area bounds and joins are outside scope.
- Prepare the supplied strokeWidth, cap 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 strokeWidth, cap. 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.extensionPerEnd, result.totalAxialExtension. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.
Require nonnegative strokeWidth and cap exactly butt, round or square. Butt returns zero extension; round and square return half the width per end and the full width in total.2
| Input field | Meaning and representation | Accepted input |
|---|---|---|
| strokeWidth | stroke width. | Finite number; zero or greater |
| cap | cap. | Text; at most 8,192 UTF-16 code units, subject to the grammar above |
| Output field | Interpretation |
|---|---|
| result | Object containing the named outputs below. |
| result.extensionPerEnd | The extension per end value under the stated formula or text convention. |
| result.totalAxialExtension | The total axial extension value under the stated formula or text convention. |
{
"input": {
"strokeWidth": 4,
"cap": "round"
},
"output": {
"result": {
"extensionPerEnd": 2,
"totalAxialExtension": 4
}
}
} Limitations and assumptions
- No join, corner, marker or actual path bounding box is computed. Curves and degenerate segment rendering need separate treatment.
- Point pairs use [x,y], rectangles and viewBox use [x,y,width,height], and all coordinate units must be consistent. This tool does not read, render or modify an SVG document.
- 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
Use a full SVG parser or rendering engine when the task includes commands and CSS values outside the documented branch. Compare coordinates and transforms under the same units and viewport convention.
References
Similar or alternative tools
- Absolute Line Command Differencer
Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.
- SVG Move Line Command Formatter
Format explicit finite M/m/L/l command records for the bounded move/line SVG branch; no other SVG grammar is accepted.