Apply a function to the diagram and all of its children recursively The function is only applied to the diagrams that contain a specific tag
Check if the diagram contains a tag
Copy the diagram
Flatten the children structure of the diagram so that the diagram only has one level of children * implemented for performance reason
Get the position of the anchor of the diagram
anchor to get, anchors can be 'top-left', 'top-center', 'top-right' 'center-left', 'center-center', 'center-right' 'bottom-left', 'bottom-center', 'bottom-right'
the position of the anchor
Get all the diagrams that contain a specific tag
the tag to filter the diagrams
a list of diagrams
Horizontal flip Reflect the diagram over a vertical line x = a
Optional
a: numberx value of the line if left undefined, flip over the origin
Create a copy of the diagram that is immutable
Move the origin of the diagram to a position or anchor
position to move the origin to (Vector2), or anchor to move the origin to. anchors can be 'top-left', 'top-center', 'top-right' 'center-left', 'center-center', 'center-right' 'bottom-left', 'bottom-center', 'bottom-right'
move_origin_text()
Move the origin of text diagram to a position
anchor to move the origin to. anchors can be 'top-left', 'top-center', 'top-right' 'center-left', 'center-center', 'center-right' 'bottom-left', 'bottom-center', 'bottom-right'
Turn the diagram into a mutable diagram
Get the point on the path at t Path can be described parametrically in the form of (x(t), y(t)) Path starts at t=0 and ends at t=1
parameter
Optional
segment_index: number(only works for polygon and curves) If segment_index (n) is defined, get the point at the nth segment If segment_index (n) is defined, t can be outside of [0, 1] and will return the extrapolated point
the position of the point
Reset all tags of the diagram
Reverse the order of the points in the path
Scale texts contained in the diagram by a scale
scaling factor
Convert the diagram to a curve If the diagram is a polygon, convert it to a curve If the diagram is a Diagram, convert all of the children to curves
Convert the diagram to a polygon If the diagram is a curve, convert it to a polygon If the diagram is a Diagram, convert all of the children to polygons
Vertical flip Reflect the diagram over a horizontal line y = a
Optional
a: numbery value of the line if left undefined, flip over the origin
Diagram Class
Diagram is a tree structure Diagram can be a polygon, curve, text, image, or diagram Polygon is a closed path Curve is an open path Diagram is a tree of Diagrams