Skip to main content

Path:add_figure()

Path:add_figure(param_table)

This method adds a figure to the path.

Note

The definition of a figure extensively employs two-dimensional vectors. A two-dimensional vector is represented by an array table with two elements, such as {10, 20}. This structure will be denoted as VEC2D in the following context.

Parameters

ParameterTypeDescription
param_tabletableThis parameter is in associative array table format, meaning it's specified by keys rather than parameter positions. See the Parameters Table section.

Parameters Table

KeyTypeDescription
fill_modestringSpecifies the fill mode with one of the following values.

'none': Indicating that it's a figures representing the outline without filling.

'winding': See this site that explains the meaning of this mode in an easy-to-understand manner.

'alternate': See this site that explains the meaning of this mode in an easy-to-understand manner.
fromVEC2DThe starting point of the figure.
segmentstableAn array table defining segments. Each element of the array refers to the Segment Definition.

Segment Definition

The definition of segments is done using one of the following tables.

  • Line Segment

    KeyTypeDescription
    toVEC2DEnd point of the line. The starting point of the line is the endpoint of the previous segment. If it's the first segment, the from of the figure becomes the starting point.
  • Arc Segment

    KeyTypeDescription
    toVEC2DEnd point of the arc. The starting point of the arc is the endpoint of the previous segment. If it's the first segment, the from of the figure becomes the starting point.
    radiusnumberThe radius of the arc.
    directionstringA value that specifies whether the arc sweep is clockwise or counterclockwise, such as 'clockwise' or 'counterclockwise'.
    arc_typestringA value that specifies whether the given arc is larger than 180 degrees, such as 'large' or 'small'
  • Bezier Curve Segment

    KeyTypeDescription
    toVEC2DEnd point of the curve. The starting point of the curve is the endpoint of the previous segment. If it's the first segment, the from of the figure becomes the starting point.
    control1VEC2DA VEC2D that represents the first control point for the curve.
    control2VEC2DA VEC2D that represents the second control point for the curve.

Return Values

This method doesn't return any value.

See Also