Carves

Carves

What are carves?

Every icoglyph is defined by its carves: a JSON array of path objects describing SVG path segments with spatial primitives. The same format feeds the web component, the static SVG endpoint, and the Forge editor.

[
  { "primitive": "l", "orientation": 0, "spatial": [0] },
  { "primitive": "c", "orientation": 0, "spatial": [3] }
]

Fields

FieldTypeDescription
primitivestringBase shape letter (l line, q square, t triangle, c circle, v vesica piscis, p point), plus an optional segment count, e.g. c2 is a half circle.
spatialnumber[][innerSize, elementSize?, position?]. The two sizes are psi exponents: each step divides the frame by the plastic number (1.3247). innerSize defaults to 0 (fills the box). position is an angle in degrees.
orientationnumberRotation of the carve in degrees.

A carve can also be a plain string: the alias of another icoglyph, embedded as a sub-glyph.

Passing carves directly

Besides aliases, <icoglyph-svg> accepts carves directly. Via the DOM property, pass a JS object or array, no JSON serialization needed:

icon.use = { primitive: 'l', orientation: 0, spatial: [0] };
icon.use = [{ primitive: 'l', orientation: 0, spatial: [0] }, { primitive: 'c', orientation: 0, spatial: [0] }];

Or as a JSON string via the HTML attribute:

<icoglyph-svg use='[{"primitive":"l","spatial":[0],"orientation":0}]'></icoglyph-svg>

The easiest way to build carves by hand is the Forge: compose primitives visually, then copy the JSON.