import std.stdio, std.math; enum width = 1000, height = 1000; // Image dimension. enum length = 400; // Trunk size. enum scale = 6.0 / 10; // Branch scale relative to trunk. void tree(in double x, in double y, in double length, in double angle) { if (length < 1) return; immutable x2 = x + length * angle.cos; immutable y2 = y + length * angle.sin; writefln("", x, y, x2, y2); tree(x2, y2, length * scale, angle + PI / 5); tree(x2, y2, length * scale, angle - PI / 5); } void main() { "".writeln; tree(width / 2.0, height, length, 3 * PI / 2); "".writeln; }