Polyline Dash Span Planner

Plan clipped one-dimensional dash spans for an explicit dash/gap cycle and phase; not a complete SVG stroking or corner renderer.

Description

Plan clipped one-dimensional dash spans for an explicit dash/gap cycle and phase; not a complete SVG stroking or corner renderer.

A dash planner can locate visible dash intervals along a one-dimensional path length before mapping them to geometry.

When to use this tool

Plan clipped one-dimensional dash spans for an explicit dash/gap cycle and phase; not a complete SVG stroking or corner renderer.

  • Prepare the supplied totalLength, dashLength, gapLength, phase 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

  1. Enter totalLength, dashLength, gapLength, phase. Use the exact text syntax, units and index conventions explained below.
  2. Run the tool. If input validation fails, correct the supplied fields before interpreting any result.
  3. Read result.dashSpans. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Require nonnegative totalLength/gapLength and positive dashLength. Normalize phase modulo dash plus gap, start at minus that phase, emit positive dash intersections with [0,totalLength) and advance by the cycle. Reject an excessive dash count.1

Input fieldMeaning and representationAccepted input
totalLengthtotal length.Finite number; zero or greater
dashLengthdash length.Finite number; greater than zero
gapLengthgap length.Finite number; zero or greater
phasephase.Finite number
Output fieldInterpretation
resultObject containing the named outputs below.
result.dashSpansThe dash spans list in the ordering and representation described above.
json
{
  "input": {
    "totalLength": 7,
    "dashLength": 2,
    "gapLength": 1,
    "phase": 0
  },
  "output": {
    "result": {
      "dashSpans": [
        [
          0,
          2
        ],
        [
          3,
          5
        ],
        [
          6,
          7
        ]
      ]
    }
  }
}

Limitations and assumptions

  • The tool returns distance spans, not SVG paths. Stroke caps, joins, a general alternating dash array and physical rendering are not modeled.
  • 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

  1. Tool behavior and example: Polyline Dash Span Planner — tool.io

Similar or alternative tools

  • Polyline Collinear Middle Pruner

    Prune middle vertices lying within a supplied perpendicular distance of the enclosing segment and between endpoints; reversals are preserved.

  • Polyline Distance Point Lookup

    Interpolate a point by Euclidean cumulative polyline distance without extrapolation; zero-length segments are skipped for interpolation.

Don't forget to set a bookmark for tool.io!
Privacy | Imprint | Cookies