Element ยท the document

line

A line through points. Lines divide a tile into regions, and can wander off its points (wobble). A width makes it a strip that dirt, grass and cliffs follow with at=, and that a scatter fills.

From above: grass above a line through three points, bare dirt below; the boundary runs straight through the marked points.

wobble=0

The same line with wobble 5: the boundary wanders a few millimetres off the straight path between the points.

wobble="5dmm"

One line through three points (marked), dividing a grass lawn from bare dirt, seen from above. On the right it wanders up to 5 design millimetres off them. From docs/elements/demo/line.dtile.

Writing it

line shore wobble="5dmm" { through "wsw" "e" }
line trail width="9dmm" wobble="3dmm" { through south "(0.65sq, 0.5sq)" north }
line ring closed=#true wobble="2dmm" { through "(0.3sq, 0.7sq)" "(0.7sq, 0.7sq)" "(0.5sq, 0.3sq)" }
line stream { through westCenter eastCenter }       // the built-in points, by name
line spur { through "(0sq, 1sq/3)" "(0.5sq, 0.7sq)" heading="30deg" pull=0.6 "(1sq, 0.5sq)" }   // a third, exactly; a heading and a pull on one point
line run curve=straight ends=free { through "(0.1sq, 0.6sq)" "(0.9sq, 0.4sq)" }                // straight runs, ends free

A line is one smooth curve through its points, square to the tile side at an end that is on a side and along the bisector at an end that is on a corner; curve=straight draws straight runs instead. A point on a tile side is on a seam. See the curve and seams in the language guide.

A line with a width is a strip: everything within half the width of it, wobble included. dirt at=trail, grass at=trail and cliff at=trail fill the strip like a region, and scatter at=trail spreads within half the width either side unless it writes its own reach. A wall follows the line itself, so a width does not widen it. A surface along a line with no width, or along a tile edge (which has none), is dt::type; for an edge write region rim { within "6dmm" of=northEdge } and at=rim. See demo/line-width.dtile.

Try it

The tile this source builds, from above
dharmatiles version="1.0.0"

// A line with a wobble: the shore of a pond.  The line goes through two points and may wander
// up to 5dmm off the straight path between them; the seed decides how.
tile size="1x1" seed=97 {
    line shore wobble="5dmm" { through "(0sq, 2sq/3)" "(1sq, 0.5sq)" }
    region pool { boundedBy shore; fill "(0.5sq, 0.85sq)" }
    region bank { boundedBy shore; fill "(0.5sq, 0.2sq)" }
    stack {
        base
        dirt
        grass at=bank
    }
}
A shore through two points, wandering up to 5dmm off the straight path between them. Drag wobble, or roll the seed: the points stay where they are written.
The tile this source builds, from above
dharmatiles version="1.0.0"

// A line is the points it goes through, in order.  This one has three and no wobble, so it is
// one smooth curve through them, square to the tile's sides; the lawn is the region above it.
tile size="1x1" seed=3 {
    line border { through "(0sq, 2sq/3)" "(0.5sq, 0.4sq)" "(1sq, 2sq/3)" }
    region lawn { boundedBy border; fill "(0.5sq, 0.1sq)" }
    stack {
        base
        dirt
        grass at=lawn
    }
}
A line is the points it goes through, in order. This one has three and no wobble, so it is one smooth curve through them, square to the tile’s sides where it ends.
The tile this source builds, from above
dharmatiles version="1.0.0"

// The same kind of line with a larger wobble.  Change the seed: the points stay where they are
// written, and the line wanders differently.
tile size="1x1" seed=12 {
    line border wobble="9dmm" { through "(0sq, 0.5sq)" "(0.5sq, 0.5sq)" "(1sq, 0.5sq)" }
    region lawn { boundedBy border; fill "(0.5sq, 0.1sq)" }
    stack {
        base
        dirt
        grass at=lawn
    }
}
The same line with a bigger wobble; the seed decides which way it wanders.
The tile this source builds, from above
dharmatiles version="1.0.0"

// A line with a width is a strip.  `verge` is 24dmm wide and the grass that follows it covers the
// strip; `trail` is narrower, and the pebbles scatter within half its width either side.
tile size="1x1" seed=5 {
    line verge width="24dmm" wobble="3dmm" { through southCenter "(0.45sq, 0.5sq)" northCenter }
    line trail width="10dmm" wobble="3dmm" { through southCenter "(0.45sq, 0.5sq)" northCenter }
    stack {
        base
        dirt
        grass at=verge
        scatter at=trail perSquare=60 { pebble }
    }
}
A line with a width is a strip; the grass fills the strip and the pebbles scatter within half the trail's width.
The tile this source builds, from above
dharmatiles version="1.0.0"

// A closed line is a loop, and its inside is a region once it has a fill point.
tile size="1x1" seed=21 {
    line ring closed=#true wobble="3dmm" { through "(0.3sq, 0.7sq)" "(0.7sq, 0.7sq)" "(0.5sq, 0.28sq)" }
    region pond { boundedBy ring; fill "(0.5sq, 0.55sq)" }
    stack {
        base
        dirt
        grass
        scatter at=pond count=3 { rock size="4dmm .. 7dmm" }
    }
}
A closed line is a loop, and its inside is a region.
The tile this source builds, from above
dharmatiles version="1.0.0"

// A point written as a range is drawn once from the seed: the line's middle point is anywhere
// from 0.3sq to 0.7sq down, a different place for another seed.  Its ends stay on seams: a
// point on a tile side is one place, never a range, so it meets the next tile's.
tile size="1x1" seed=18 {
    line shore wobble="3dmm" { through "(0sq, 0.5sq)" "(0.5sq, 0.3sq .. 0.7sq)" "(1sq, 0.5sq)" }
    region bank { boundedBy shore; fill "(0.5sq, 0.1sq)" }
    stack {
        base
        dirt
        grass at=bank
    }
}
A point written as a range is drawn once from the seed: roll it and the middle of the line moves. The ends stay on seams, since a point on a side is one place.

Reference

WrittenTakesDefaultWhat it does
line NAMEa nameโ€”Its name, for boundedBy and at=. Required.
width=length (dmm)โ€”Makes the line a strip of this width (above 0, up to 70dmm, scaled with the system); a dirt, grass or cliff at= it fills the strip, and a scatter reaches half of it either side.
wobble=length (dmm)0Lets the line wander up to this far off its points, keyed by the tile seed and the line's name.
curve=smooth or straightsmoothOne smooth curve through the points (cubic Bézier, handles 0.4 of the chord, Catmull-Rom directions), or straight runs, exactly as the points say.
ends=square or freesquaresquare: an end exactly on a tile side leaves along the side's normal, and exactly on a tile corner along the corner's bisector (45° to both sides). free: the ends take their direction from the neighbouring points.
closed=#true or #false#falseA loop: the last point joins the first (at least three points). The inside of a closed line is a region with fill.
throughpointsโ€”The points, in order: "(across, down)" with units, counted from the north-west corner, a point's name (built in or declared), an edge word (its middle) or a corner word. Either half of a pair may be a range, weighted or not ("(0sq .. 0.1sq, 0.3sq .. 0.5sq)", "(bell(0.4sq .. 0.6sq), 0.45sq)"): that point is drawn once from the tile seed, keyed by the line's name and its place in the list, so another seed draws another line and editing one point moves no other. A point on a tile side is also written as a seam word: nnw, n, nne are a third, a half and two thirds along the north side from the west (ssw s sse south, wnw w wsw west and ene e ese east, from the north), and nw ne se sw are the tile's corners. On a side longer than one square the word takes its square, counted from 1 from the west or the north, and is quoted: "nnw(2)". Required.
through of one point: corner=#true or #false#falseA sharp knee at this point instead of a smooth bend.
through of one point: heading=an angle, "30deg"the chord of its neighbours, or square to the sideThe way the line goes through this point: 0deg is east, 90deg south, as polar reads. Allowed on any point.
through of one point: pull=0 to 31How far the curve holds its direction at this point, as a share of the usual.

Notes

An element along a drawn line takes side=left, right or centre (the default), as you walk the line. Along a tile edge there is no side: a wall or cliff on an edge always stands inside the tile. Edges, corners and points are in the language guide.

On a through of one point, corner=#true makes a sharp knee, heading= sets the way the line goes through it and pull= how far it holds that direction (the reference lists them under through). A tile that writes seams=free may cross an edge anywhere; otherwise a point on a side that is not a seam is dt::seam.

Seen from the language

The guide pages that use line: Syntax, Lines, Seams, Regions, Seeds.