nocad.viz.cactus_layout#

nocad.viz.cactus_layout(cacti, n_states, node_gap=0.8, lane_gap=0.45)[source]#

Positions for drawing control cacti (see control_cacti()).

The cacti are drawn as horizontal trees: the stem of every input is the spine of its tree (from x = 1, the input at x = 0); every bud is a child of the node whose edge attaches it, placed one step to the right of that node, and the first bud attached to a bud continues its row, further buds are stacked above and below. Subtrees are measured first, so siblings never overlap; the cacti are stacked vertically and unattached buds go to the bottom.

Returns:
layoutBunch with pos (N, 2), inputs (M, 2) input positions, bud_center

and bud_radius (per bud).