PolyOffset2D

Inherits: Reference < Object

Polygon deflating and inflating.

Description

A singleton which provides various method for polygon and polylines deflating, inflating, buffering etc.

A new local instance must be created manually with new_instance method if you need to override the default parameters, else the methods in this class are available globally:

var polygons = []
# Globally.
polygons = PolyOffset2D.deflate_polygons([poly_a, poly_b])
# Locally.
var po = PolyOffset2D.new_instance()
po.parameters.miter_limit = 3.0
polygons = po.deflate_polygons([poly_a, poly_b])

Methods

Array deflate_polygons ( Array polygons, float delta ) const
Array deflate_polylines ( Array polylines, float delta ) const
Array inflate_polygons ( Array polygons, float delta ) const
Reference new_instance ( ) const

Property Descriptions

Setter set_parameters(value)
Getter get_parameters()

Parameters to configure the default behavior of operations. Cannot be configured via the global instance, use new_instance first if you need to override the defaults.

Method Descriptions

Deflates an array of polygons by delta pixels, growing the polygons outward.

Each polygon’s vertices will be rounded as determined by PolyOffsetParameters2D.join_type.


Deflates (grows) polylines into polygons by delta pixels.

Each polygon’s vertices will be rounded as determined by PolyOffsetParameters2D.join_type.

Each polygon’s endpoints will be rounded as determined by PolyOffsetParameters2D.end_type, except for the PolyOffsetParameters2D.END_POLYGON as it’s used by polygon offsetting specifically, use PolyOffsetParameters2D.END_JOINED to grow a polyline like a closed donut instead.


Inflates an array of polygons by delta pixels, shrinking the polygons inward. Returns an empty array if delta approximately exceeds the minimum bounding rectangle dimensions of each of the polygons.

Each polygon’s vertices will be rounded as determined by PolyOffsetParameters2D.join_type.


Instantiates a new local PolyOffset2D instance, and parameters can be configured.