Skip to content

Polygon-Object

  • for p in poly:all() do .. iteration over all polygon vertices. p references to the vertex of the current table-row.
  • local p = poly:append() appends a polygon vertex to polygon poly. p is the reference to the new vertex.
  • local p = poly:insert_after(prev_vert) inserts a polygon vertex right after poly. The new vertex follows prev_vert. p is the new vertex. Inserting during iterator executing will not iterate over the newly inserted vertex.
  • poly:area2d()2D-area of closed polygons
  • poly:area3d() 3D-area of closed polygons
  • poly:length2d() 2D-length of polygons
  • poly:length3d() 3D-length of polygons
  • poly:simplify_geometry(stichxy) simplify geometry in x, y direction
  • poly:simplify_geometry(stichxy, stichz) simplify geometry in x-, y-direction (stichxy) and in z direction (stichz).
  • #poly number of vertices (points) in polygon, alternatively: poly:num_vertices()
  • poly:is_closed() true if polygon is closed, false if it has two ends
  • poly:first() returns the first polygon point defined in the polygon's geometry
  • poly:is_complex() returns true if the polygon is complex (containing self-intersecting edges or holes), otherwise returns false
  • poly:is_convex() returns true if the polygon is convex, otherwise returns false
  • poly:is_inside(x,y)returns true if the referred point (x,y) is within the polygon, false otherwise. The result for self-cutting polygons is indeterminate.