Schemas / Geometry / paint

rig.geometry.path

v1.0.0 · stable maturity: stable 2 fields 1 required

Fields

FieldTypeMeaning
commands array<object> required Ordered path commands
fillRule enumnonzero · evenodd optional Optional. nonzero, evenodd; absent = nonzero

Freeform 2D path command stream. Format when present. Space curves use rig.geometry.path3d.

Not a parametric shape. A contour that stays editable as parameters belongs to one of the primitives - rectangle, ellipse, line, polygon, regular_polygon, star, arc, ring, spline. Use a path once it has been resolved to commands, and never both for the same contour. A freeform contour may contain arc-to. A contour that is still an editable centre-and-angles span stays arc. The same contour is never both.

Command

Closed contours use a close command. Skip or reject unknown types. Extend only by appending enum values.

Holes are extra move-to ... close subpaths - no holes array. First subpath is the outer (clockwise in 2D page space). Later subpaths with opposite winding punch holes when fillRule is nonzero. Under evenodd, overlap toggles and winding sign does not matter. Fonts / UFO stay nonzero. Glyph contours are in font-unit y-up (rig.font.glyph); opposite-winding subpaths still punch holes. Do not put fillRule on paint. Appearance: rig.paint.fill_stroke. Text that follows this contour composes rig.media.text_path on the run.

JSON Schema

Resolves at https://rig.works/schemas/rig.geometry.path.schema.json — raw file.

{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://rig.works/schemas/rig.geometry.path.schema.json",
  "title": "rig.geometry.path",
  "type": "object",
  "additionalProperties": false,
  "properties": {
    "commands": {
      "type": "array",
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "move-to",
              "line-to",
              "cubic-to",
              "quad-to",
              "close",
              "arc-to"
            ]
          },
          "point": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          },
          "control1": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          },
          "control2": {
            "$ref": "./_defs.schema.json#/$defs/vec2"
          },
          "radiusX": {
            "$ref": "./_defs.schema.json#/$defs/float"
          },
          "radiusY": {
            "$ref": "./_defs.schema.json#/$defs/float"
          },
          "xAxisRotationDegrees": {
            "$ref": "./_defs.schema.json#/$defs/float"
          },
          "largeArc": {
            "$ref": "./_defs.schema.json#/$defs/bool"
          },
          "sweep": {
            "$ref": "./_defs.schema.json#/$defs/bool"
          }
        }
      }
    },
    "fillRule": {
      "type": "string",
      "enum": [
        "nonzero",
        "evenodd"
      ]
    }
  },
  "required": [
    "commands"
  ],
  "x-rig-maturity": "stable"
}

Seen in

cad-solids.json · font-ufo.json · font-var.json · text-path.json