Absolute Line Command Differencer

Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.

Description

Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.

Absolute line-command coordinates can be differenced into relative displacements while retaining command identity.

When to use this tool

Difference explicit absolute SVG M/L commands against the preceding current point, initially the origin; no curves or closepath.

  • Prepare the supplied commandsJson 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 commandsJson. 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.relativeCommands. Interpret false, null and empty lists using the distinctions below; they can be valid outputs.

Parse commandsJson records with command exactly M or L and finite x/y. Start at (0,0), emit lowercase command with displacement from the preceding point and update that point.1

Input fieldMeaning and representationAccepted input
commandsJsonJSON text, entered as one text field. The decoded structure is illustrated below; it is not a separate file.Text

For the JSON text fields, the following decoded structures show the example records before they are serialized into input strings. Keep field names, list nesting and value types as shown.

json
[
  {
    "field": "commandsJson",
    "decoded": [
      {
        "command": "M",
        "x": 1,
        "y": 2
      },
      {
        "command": "L",
        "x": 4,
        "y": 6
      }
    ]
  }
]
Output fieldInterpretation
resultObject containing the named outputs below.
result.relativeCommandsThe relative commands list in the ordering and representation described above.
json
{
  "input": {
    "commandsJson": "[{\"command\":\"M\",\"x\":1,\"y\":2},{\"command\":\"L\",\"x\":4,\"y\":6}]"
  },
  "output": {
    "result": {
      "relativeCommands": [
        {
          "command": "m",
          "x": 1,
          "y": 2
        },
        {
          "command": "l",
          "x": 3,
          "y": 4
        }
      ]
    }
  }
}

Limitations and assumptions

  • This record transform does not enforce an initial moveto or parse arbitrary SVG path syntax. No curves, closepath or subpath-origin handling beyond supplied coordinates is included.
  • 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.
  • Lists are limited to 128 entries. JSON text must meet bounded size and depth checks, and numeric outputs beyond the safe finite magnitude are rejected. Exact large integers use decimal strings.
  • 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: Absolute Line Command Differencer — tool.io

Similar or alternative tools

  • 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.

  • SVG Move Line Command Parser

    Parse the bounded SVG M/m/L/l number-pair branch with implicit lineto after moveto; reject curves, closepath and incomplete commands.

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