Layout
import mathy_core.layout
Mathy uses the Tidier algorithm to create visual tree layouts for helping understand and interpret complex node trees.
API¶
TreeLayout¶
TreeLayout(self, args, kwargs)
layout¶
TreeLayout.layout(
self,
node: mathy_core.tree.BinaryTreeNode,
unit_x_multiplier: float = 1.0,
unit_y_multiplier: float = 1.0,
) -> 'TreeMeasurement'
Returns a TreeMeasurement object that describes the bounds of the tree
transform¶
TreeLayout.transform(
self,
node: Optional[mathy_core.tree.BinaryTreeNode] = None,
x: float = 0,
unit_x_multiplier: float = 1,
unit_y_multiplier: float = 1,
measure: Optional[TreeMeasurement] = None,
) -> 'TreeMeasurement'
Return a measurement of the tree in output units.
TreeMeasurement¶
TreeMeasurement(self) -> None