hatch
hatch
Fill — plotter marks via clipped parallel / cross hatch strokes. See Fills.
Imports
import { hatchParallel, hatchCross, hatch, type ParallelHatchOptions } from 'pattapatta'
// or from 'pattapatta/hatch' hatchParallel(path, options?: ParallelHatchOptions) → Segment[]
| Option | Default | Meaning |
|---|---|---|
angle | π/4 | Line direction (radians) |
spacing | 0.15 | Perpendicular spacing |
count | auto | Line count; omit to cover the whole path AABB |
length | bbox diagonal | Pre-clip half-length |
center | bbox center | Field center |
hatchCross(path, options?)
Two perpendicular parallel fields.
Examples
Parallel
const strokes = hatchParallel(createRect(15, 15, 70, 70), {
spacing: 6, angle: Math.PI / 4,
}) Cross
const strokes = hatchCross(createRect(15, 15, 70, 70), { spacing: 8 }) Serialize with toSvg(group(segmentsToOpenPaths(strokes))).