Polygon:simplify

From GiderosMobile
Revision as of 18:24, 14 November 2026 by MoKaLux (talk | contribs) (Created page with "__NOTOC__ '''Available since:''' Gideros 2015.03.22<br/> '''Class:''' Clipper<br/> === Description === Simplifies the polygon by removing redundant vertices and resolving...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Available since: Gideros 2015.03.22
Class: Clipper

Description

Simplifies the polygon by removing redundant vertices and resolving self-intersections, using the given fill rule.

(table) = Polygon:simplify(fillType)

Parameters

fillType: (number, optional, default = Polygon.FILL_EVEN_ODD) one of Polygon.FILL_EVEN_ODD, FILL_NON_ZERO, FILL_POSITIVE, FILL_NEGATIVE

Return values

Returns (table) array of Polygon objects (1 indexed). The result may contain several polygons when the input is self-intersecting

Example

local res = poly:simplify(Polygon.FILL_EVEN_ODD)
for i = 1, #res do
	print("simplified polygon", i, "area", res[i]:getArea())
end