The result

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" }
}
}
Say it plainly
The whole tile is the default area, so a tile with no lines needs no regions. When lines divide the tile, you name the area you mean by naming the lines around it and dropping a point inside, like a paint bucket.
Everything you build also makes a region of its own, a tree’s crown or a rock’s disc, and regions nest. That is how a formula can ask where it is inside the thing it belongs to.
The rules
A region is the area its lines bound round its fill points
The whole tile is the default area, so an undivided tile needs no region. A region exists when lines divide the tile. It is the paint-bucket model: name the lines that bound it, then drop one or more fill points.
region verge { boundedBy trail; fill "(0.15sq, 0.5sq)"; fill "(0.85sq, 0.5sq)" }
Several fill points on different sides of a line join areas without union, intersection or difference. Elements act inside a region with at=verge.
Every thing makes a region, and regions nest
Every frame is a region, and regions nest. A point or a line says where a thing goes; the thing's size makes its region: a tree's crown round its point, a rock's disc, a wall's strip along its line, a scatter's area. A $region is the region of the thing being built (at a declaration, the region the declaration sits in), $tile is the root, and parent($region) is the region containing it.
- The tile has no parent:
parent($tile)isdt::region“the tile has no parent”. - A named region's parent is the smallest strictly larger region that holds its first fill point, else the tile. Regions that only share a line, like a pool and its bank, are siblings.
- A
scatteris a region of its own, itsat=area (or the tile); the things it places are its children: a tree in a scatter at tile level has the scatter, then$tile. - A body, coat or scatter with no region of its own acts in its
at=region, else the tile.
A region is its own kind of value: it goes to parent() and to the coordinate calls, never to arithmetic. check refuses a read of a parent that is not there before any build, at the exact spot. dharmatiles check --explain prints the tree:
regions
$tile: tile, parent none
scatter (entry 2): scatter, parent $tile
tree (entry 2, thing 1): placed disc, 18.0 mm across, parent scatter (entry 2)
rock (entry 2, thing 2): placed disc, 6.0 mm across, parent scatter (entry 2)
entry 1 `dirt` acts in $tile
entry 2 `scatter` acts in scatter (entry 2)
A place is a point, a line or a region
A place is a point, a line or a region, all flat: they say where, never how high. Every tile has them built in, named in camelCase:
| Kind | Declared | Built in on every tile |
|---|---|---|
| point | point knoll "(0.28sq, 0.72sq)" | northWestCorner northCenter northEastCorner westCenter center eastCenter southWestCorner southCenter southEastCorner |
| line | line stream wobble="4dmm" { through … }, closed=#true for a loop | northEdge eastEdge southEdge westEdge, and edges for all four |
| region | region meadow { … } | the whole tile is what no at= means |
A place is written as a name or as a literal point "(x, y)". A region is its fill points and its discs less what it excepts:
region banks { within "4.5dmm" of=stream } // a disc round a point, a strip beside a line, a ring round a region
region verge { except path } // a region that only excepts is the whole tile less those
region knoll { boundedBy foot; fill center } // the paint bucket
One place word, at=, says where an entry goes, and it takes any place: a point, a line or a region. Each element takes the kinds that mean something to it and refuses the others with dt::type and a help line: a body, grass or reeds fills a region (a body or grass may also follow a line); a wall follows a line; a thing stands at a point or fills a region, and given a line it is refused (a line has no one place on it: write a scatter); a scatter fills a region or spreads along a line, within reach either side of it, and given a point it is refused (write a region round it, within "5dmm" of=knoll). With no at= an entry covers the whole tile. within, except and boundedBy build places; they never use one. See point, line and region.
Errors this page explains
dt::unknown-regionNo region has that name The ruledt::empty-regionA region covers nothing The ruledt::regionA region cannot be made: it names a place that is not there, or leads back to itself The rule
Next
Next: the stack, where the tile’s elements are listed and built.