Class PolyNode

PolyNodes are encapsulated within a PolyTree container, and together provide a data structure representing the parent-child relationships of polygon contours returned by the Clipper:Execute method.

A PolyNode object represents a single polygon. Its IsHole property indicates whether it's an outer or a hole. PolyNodes may own any number of PolyNode children (Childs), where children of outer polygons are holes, and children of holes are (nested) outer polygons.

Methods

PolyNode:ChildCount ()

Returns:

    uint Number of children directly owned by the node.
PolyNode:GetChild (index[, opts])
Get one of the node's children.

Outer PolyNode childs contain hole PolyNodes, and hole PolyNode childs contain nested outer PolyNodes.

Parameters:

  • index uint Child index, from 1 to PolyNode:ChildCount.
  • opts table

    Options, which include:

    • out: If this is a PolyNode, it will be populated and used as the return value.
    (optional)

Returns:

    PolyNode
PolyNode:GetContour ([opts])

Parameters:

  • opts table

    Options, which include:

    • out: If this is a Path, it will be populated and used as the return value.
    (optional)

Returns:

    Path
PolyNode:GetNext ([opts])

Parameters:

  • opts table

    Options, which include:

    • out: If this is a PolyNode, it will be populated and used as the return value.
    (optional)

Returns:

    PolyNode or nil N
PolyNode:GetParent ([opts])

Parameters:

  • opts table

    Options, which include:

    • out: If this is a PolyNode, it will be populated and used as the return value.
    (optional)

Returns:

    PolyNode or nil If the node is not also a PolyTree, its parent; otherwise nil.

See also:

PolyNode:IsHole ()

Returns:

    boolean Is the node's contour a hole?

    Children of outer polygons are always holes, and children of holes are always (nested) outer polygons. In a PolyTree this property is undefined, but its children are always top-level outer polygons.

PolyNode:IsOpen ()

Returns:

    boolean Did the node's contour result from a clipping operation on an open contour (path)?

    Only top-level PolyNodes can contain open contours.

PolyNode:ToTree ([opts])

Parameters:

  • opts table

    Options, which include:

    • out: If this is a PolyTree, it will be populated and used as the return value.
    (optional)

Returns:

    PolyTree or nil If the node is also a PolyTree, a rewrapping of this node as the corresponding Lua object; otherwise nil.
generated by LDoc 1.4.6 Last updated 2018-08-13 18:06:38