Polygon:simplify

From GiderosMobile

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