render_nodes_to_surface = function(font) -- design constraints: -- trees only, no graphs or DAGs -- parents above children -- a child shares its parent's column exactly only if it's an only child -- parents can overlap columns with children and more distant descendants -- siblings never share a column -- siblings never overlap columns -- siblings always occupy the same row -- cousins/aunts/nephews never overlap columns Surface = {} -- compute number of tracks needed for _,x in pairs(Nodes) do if x.ntracks == nil then x.ntracks = compute_ntracks(x) end end -- prepare the tracks -- each track is 600px + 20px of gutter between nodes render_node_and_descendants(Root.id, --[[y]] 0, --[[xlo]] 0, --[[xhi]] 620 * Root.ntracks, --[[grandparent surface node]] nil, font) end