Polygon:getPolygonOffset

From GiderosMobile

Available since: Gideros 2015.03.22
Class: Clipper

Description

Offsets (insets or outsets) the polygon by delta units.

(table) = Polygon:getPolygonOffset(delta,joinType,limit,autoFix)

A positive delta grows the polygon outward, a negative delta shrinks it inward.

Parameters

delta: (number) offset distance in units
joinType: (number, optional, default = Polygon.JOINT_SQUARE) one of JOINT_SQUARE, JOINT_ROUND, JOINT_MITER
limit: (number, optional, default = 0) miter limit, used only with JOINT_MITER
autoFix: (boolean, optional, default = true) whether to fix self-intersections in the result

Return values

Returns (table) array of Polygon objects (1 indexed). The result may contain several polygons

Note

In this version of the plugin the joinType argument is ignored by the C++ binding and square joins are always used.

Example

local grown = poly:getPolygonOffset(8, Polygon.JOINT_ROUND, 2, true)
local shrunk = poly:getPolygonOffset(-4)