wumpus-tree-0.13.0: Drawing trees

PortabilityGHC
Stabilityhighly unstable
MaintainerStephen Tetley <stephen.tetley@gmail.com>

Wumpus.Tree.Design

Description

A variant of the tree drawing algorithm from Andrew Kennedy - Functional Pearls Drawing Trees 1996.

Acknowledgment - although based on Andrew Kennedy's algorithm, this version uses absolute extents rather than relative ones and is a somewhat different in detail if not in spirit to the original.

Any mistakes are mine of course.

Synopsis

Documentation

design :: (Fractional u, Ord u) => Point2 u -> ScalingContext u Int u -> Tree a -> CoordTree u aSource

Design a tree, properly balancing the child nodes oriented at root.

As the design has no y-positions (but by recursion they can be counted) and x-positions are respective to the unit distance 1.0 separating nodes it is rescaled as a post-processing step into drawable coordinates.