Skip to content

Main content

Random Fractal Tree Branch Layout Generator

Construct a depth-bounded binary branch tree from explicit length and angle rules with parent traces; no botanical realism is inferred.

Loading tool…

Description

Construct a depth-bounded binary branch tree from explicit length and angle rules with parent traces; no botanical realism is inferred.

Procedural artwork expresses a visual idea through coordinates, repeated motifs, colors, or explicit placement constraints. A coordinate plan can be checked and reproduced before rendering, while physical material behavior and fabrication require separate information.

Construct a depth-bounded binary branch tree from explicit length and angle rules with parent traces; no botanical realism is inferred.

When to use this tool

Use this generator to create reproducible fractal tree branch layout cases from the supplied model or bank. Inspect the returned evidence before using cases in a test or exercise.

How to use the tool and how it works

  1. Supply depth, rootLength, headingTurns, lengthRatio, minimumAngleTurns, maximumAngleTurns in the field shapes below. Set seed when you need an explicit replay.
  2. Run the tool and correct any input error. For generated controls, distinguish a successful fixture containing an invalid case from failure to generate the fixture.
  3. Read branches, bounds. Use the conventions below. Keep answer-bearing fields separate when presenting an exercise.

Grow a binary branch tree from the origin. Compute each endpoint from length and heading in turns; at every nonterminal branch, draw independent left and right angular deviations and scale child lengths by lengthRatio.1

Input fieldMeaning and unitsAccepted input
depthDepthRequired. Safe integer; minimum 0; maximum 5.
rootLengthRoot LengthRequired. Finite number; strictly above 0.
headingTurnsHeading TurnsRequired. Finite number.
lengthRatioLength RatioRequired. Finite number; maximum 1; strictly above 0.
minimumAngleTurnsMinimum Angle TurnsRequired. Finite number; minimum 0; maximum 0.5.
maximumAngleTurnsMaximum Angle TurnsRequired. Finite number; minimum 0; maximum 0.5.
seedOptional numeric seed; takes precedence over context randomness. Without either, use the fixed tool.io default seed.Optional. Safe integer.
Output fieldInterpretationReturned shape
branchesBranchesRequired. Array of Object; no unknown keys.; minimum items 1; maximum items 63.
branches[].idLiteral identifier used independently of display labels.Required. Safe integer; minimum 0; maximum 62.
branches[].parentParentRequired. Safe integer; minimum -1; maximum 62.
branches[].depthDepthRequired. Safe integer; minimum 0; maximum 5.
branches[].fromFromRequired. Array of Finite number.; minimum items 2; maximum items 2.
branches[].toToRequired. Array of Finite number.; minimum items 2; maximum items 2.
branches[].lengthLengthRequired. Finite number; strictly above 0.
branches[].headingTurnsHeading TurnsRequired. Finite number.
boundsBoundsRequired. Object; no unknown keys.
bounds.minXMin XRequired. Finite number.
bounds.minYMin YRequired. Finite number.
bounds.maxXMax XRequired. Finite number.
bounds.maxYMax YRequired. Finite number.
bounds.widthWidthRequired. Finite number.
bounds.heightHeightRequired. Finite number.
randomnessReplay source and normalized 32-bit seed, or null seed for an advancing context source.Required. Object; no unknown keys.
randomness.seedOptional safe-integer replay seed; normalization and precedence are explained below.Required. Safe integer. or Null.
randomness.sourceSourceRequired. Text; one of "context", "seed".

An explicit safe-integer seed takes precedence over injected context randomness and is normalized to an unsigned 32-bit integer. With no seed and no context source, replay uses the fixed tool.io default seed. A context source must return finite values from zero inclusive to one exclusive; its advancing state must be retained separately. randomness records the source and normalized seed, or null for context. These generators are not cryptographic random sources.

json
{
  "input": {
    "depth": 1,
    "rootLength": 4,
    "headingTurns": 0,
    "lengthRatio": 0.5,
    "minimumAngleTurns": 0.25,
    "maximumAngleTurns": 0.25,
    "seed": 42
  },
  "output": {
    "branches": [
      {
        "id": 0,
        "parent": -1,
        "depth": 0,
        "from": [
          0,
          0
        ],
        "to": [
          4,
          0
        ],
        "length": 4,
        "headingTurns": 0
      },
      {
        "id": 1,
        "parent": 0,
        "depth": 1,
        "from": [
          4,
          0
        ],
        "to": [
          4,
          -2
        ],
        "length": 2,
        "headingTurns": -0.25
      },
      {
        "id": 2,
        "parent": 0,
        "depth": 1,
        "from": [
          4,
          0
        ],
        "to": [
          4,
          2
        ],
        "length": 2,
        "headingTurns": 0.25
      }
    ],
    "bounds": {
      "minX": 0,
      "minY": -2,
      "maxX": 4,
      "maxY": 2,
      "width": 4,
      "height": 4
    },
    "randomness": {
      "seed": 42,
      "source": "seed"
    }
  }
}

Limitations and assumptions

  • The root has parent minus one and depth zero. Branches can overlap or cross. Depth expands output exponentially, and lengths or displacements below numeric resolution are rejected; no botanical growth model is implied.
  • A replay requires the same complete input and implementation. The stated sampling convention applies within its eligible space. A finite draw does not exhaust all possible outputs; repeats remain possible unless a distinct-selection rule is explicit.
  • The field tables state structural bounds; cross-field constraints and bounded search or output budgets also apply. Unknown keys are rejected where the object contract disallows them. Input errors are distinct from null fields and deliberate invalid controls in a successful output.

Alternative or Complementary methods

For a supplied example, inspect the returned construction or delegated check directly. To evaluate a consumer, also test cases chosen for its own boundaries; a generated finite corpus does not establish exhaustive coverage.

References

  1. Tool behavior and example: Random Fractal Tree Branch Layout Generator — tool.io

Similar or alternative tools