Element · thing

tree

One deciduous tree: a twisting barked trunk that forks into branches, each ending in a rounded clump of foliage covered in separate, chunky leaves. The look is slightly cartoonish. Every branch climbs at least 26° and every leaf on an underside lies flat, so the tree prints without supports.

A ready-made tree is a definition: use "parts/trees" oak. Several trees are a scatter: scatter count=2 { oak }, or a row along a line: scatter at=road count=3 reach="3dmm" { oak }. A scatter of trees keeps every crown clear of the others; a single tree at= a line is refused, a line has no one place on it.

Sizes
40dmm tall by default (20 to 120 over its foot); crown about 30dmm across
Variants
leafy, foliage clumps only, or bare (winter)
Printing
no supports; branches at least 26° above horizontal
In the library
ground/1x1-grass-tree, ground/2x2-grass-tree, water/1x1-water+grass-tree
Words used on this page
crown
The leafy top of the tree: everything above the bare trunk.
clump
A rounded mass of foliage at the end of one branch. The leaves sit on the clumps.
leaf
One separate printed leaf, 4.5 × 3 mm and 0.24 mm thick, rooted into a clump.
shingling
Leaves overlapping like roof tiles: each upper leaf sits a little proud of the one below it.
branching
How the trunk divides: a few long limbs, or many forks.
A one-square grass tile with one leafy tree
lib:tiles/ground/1x1-grass-tree.dtile, built by the program today.

What it looks like

The trunk flares at the ground and carries bark grooves that wind up it and continue through every fork. Branches divide cleanly, like an architect's sketch of a tree, never tangling or doubling back. Each branch ends in a rounded clump of foliage, and the clumps merge into one lumpy crown.

The crown is covered completely in separate leaves: no bare patches, and no visible rows or rings. Leaves point down-slope with a gentle, coherent swirl, and overlap like shingles, each sitting a little higher than the leaf it covers, so every leaf reads on its own. On top of the crown the leaf tips curl up; underneath, where a hanging leaf could not print, leaves lie flat against the clump in a low arch.

No two seeds grow the same tree, but every tree has the same character.

Using it in a tile

A tree's height is its top=, written like every top as a length above zero, where $bottom is the ground at the tree's foot: top="$bottom + 40dmm" is a 40dmm tree wherever it stands, and top="$groundHeight + 40dmm" reaches 40dmm over the ground height, shorter on a mound and taller in a hollow. Without top= a tree is 40dmm over its foot.

The top is a cloud like every top: a low surface, a high surface and one weighting, worked out at each branch tip. The tree's own region is a disc round its trunk, so $d is 0% at the trunk and 100% at the crown's rim, $a runs round it, $x and $y are the tile's, and parent($region) is the region the tree stands in (its scatter's, else the tile). A dome is top="$bottom + 40dmm - 6dmm * $d * $d"; a grove taller in the middle is top="$bottom + 36dmm + 20dmm * (1 - d(parent($region), %))", read at each tip in the grove's region. Each tip rolls smoothly inside its cloud (neighbouring tips alike, so the crown is not speckled) and the weighting is read by the tip's rank over the whole crown, so top="$bottom + high(34dmm .. 44dmm)" gives mostly tall tips. The crown is stretched or squeezed to meet its tips, and it stays under the cloud's high: the tips stand a clump's depth under it, so the clumps and leaves above them do not pass it. A top that leaves a tip no room above the bare trunk is refused where it is low (trunk height is the height of the crown's base).

A tree goes anywhere in its area, kept a crown's radius from the tile edge, or where at= says. Grass grows round the trunk when it is listed after the tree; a dirt listed after the tree banks against the trunk:

dharmatiles version="1.0.0"

use "parts/grass" long-grass

tile size="2x2" seed=84 {
    stack {
        base
        dirt clods=none
        tree top="$bottom + 49dmm" {        // or: tree at="(1sq, 1sq)" top="$bottom + 49dmm"
            trunk height="30dmm"            // bare trunk below the crown
            crown width="30dmm" clumps=32 shape=round branching=normal
            leaf length="4.5dmm" width="3dmm"
        }
        long-grass                          // after the tree: grows round the trunk
    }
}

leaves clumps-only leaves off the separate leaves; leaves bare makes a winter tree. The six branching knobs (branch split=… eagerness=…) are expert controls, allowed only in a parts file:

dharmatiles version="1.0.0"

use "parts/trees" oak

tile size="2x2" seed=3 {
    stack {
        base
        dirt
        scatter count=2 { oak }                         // a let whose body is one bare thing is a thing
        oak at="(1sq, 1sq)" top="$bottom + 60dmm"       // a call's top= is its tree's
    }
}

A top that reads d(parent($region), %) is read in the region the tree stands in, so a grove is taller in the middle (library/tests/plants/2x2-grove.dtile):

dharmatiles version="1.0.0"

tile size="2x2" seed=8 {
    region clearing { within "28dmm" of=center }
    stack {
        base
        dirt clods=none
        scatter at=clearing count=5 gap="4dmm" {
            tree top="$bottom + high(34dmm .. 40dmm) + 22dmm * (1 - d(parent($region), %))" {
                trunk height="13dmm"
                crown width="14dmm" clumps=24 shape=round branching=normal
            }
        }
    }
}

Reference

Kind
a thing: one solid, standing on the surface
Place
at= region, point
Built
yes

Controls

ControlTakesDefaultWhat it does
trunkgroup—the bare trunk
trunk heightlength (dmm), 0 to 200, or a range, or a weighted range18dmmbare trunk below the crown
trunk widthlength (dmm), 0.5 to 40, or a range, or a weighted rangegrows with the branches it carriestrunk thickness at the ground
crowngroup—the crown
crown widthlength (dmm), 2 to 200, or a range, or a weighted range30dmmcrown width
crown shapewordroundsilhouette
round
a round crown
cone
pointed at the top, like a fir (provisional)
wide
a broad, flat-bottomed spread (provisional)
tall
a narrow column (provisional)
crown clumpscount, 8 to 20032clumps of foliage, one per branch end
crown clumpSizelength (dmm), 1 to 20, or a range, or a weighted range5.5dmmsize of each clump
crown branchingwordnormalfew long limbs, or many forks; the only branching control in a tile
open
few long limbs (provisional)
normal
between the two: some long limbs, some forks
dense
many forks (provisional)
leaveswordonseparate leaves, just clumps, or a winter tree
on
separate leaves over the clumps
clumps-only
just foliage clumps
bare
a winter tree
leafgroup—one leaf
leaf lengthlength (dmm), 0.5 to 20, or a range, or a weighted range4.5dmmleaf length
leaf widthlength (dmm), 0.5 to 20, or a range, or a weighted range3dmmleaf width
topheightits own height, not held to a levelhow high the top stands, as a height worked out where it stands: $bottom + [4dmm .. 9dmm]
Expert controls (parts files only)
ControlTakesDefaultWhat it does
branchgroup—the generator's six branching knobs (expert: parts files only)
branch splitangle (deg), 1 to 89—half-angle of the cone a branch keeps
branch eagernessnumber, 0 to 1—1 splits early, 0 only near the tips
branch targetnumber, 0 to 1—aim point in the attractor cloud, 0 low to 1 high
branch balancenumber, 0 to 1—how evenly a fork shares its attractors, 0 to 1
branch exponentnumber, 1 to 8—pipe-model exponent
branch minRadiuslength (dmm), 0.2 to 5—branch radius at a tip

In the library

Generated from dharmatiles elements tree by cargo xtask docs.

Sizes

Edges and neighbours

Rules

What this element always does. A change to one of these is a change to the element.

Printing and painting

How it is made

Step by step

A tree grows toward its crown: a cloud of points fills the crown's shape, and branches grow from the trunk toward them, forking only in between. Printability is built in, not checked afterwards: no branch climbs at less than 26°, every clump is cut to stand on its own branch, and leaves on an underside lie flat.

What the program does, in order:

  1. Crown: the crown's envelope (round, cone, wide or tall) and its attractor points, sampled over its surface by area and grouped about 20 mm across.
  2. Skeleton: space colonisation: every attractor becomes a branch end, every branch lands on its attractor, forks happen only in between, and no edge is below 26°.
  3. Wood: a smooth tube along every branch, barked with grooves that run through the forks, the trunk flared and sunk into the ground, all one closed volume.
  4. Clumps: a rounded cone of foliage at each branch end, noised, cut so it stands on its own branch with no hanging underside.
  5. Leaves: separate leaves over the clumps, shingled; tips curl up on top and lie flat underneath, where a hanging leaf could not print.
  6. Place: at at=, or anywhere in its area with the trunk a crown's radius from the tile edge and clear of other solids.

The code: crates/dt-elements/src/tree/.

Seen from the language

The guide pages that use tree: Placement and scatter, Names, Heights, Clouds, Things and layers, Worked tiles.