Clipper: Difference between revisions
wip |
wip |
||
| Line 35: | Line 35: | ||
[[Polygon:getPolygonOffset]] ''offsets (insets or outsets) the polygon by delta units''<br/><!--GIDEROSMTD:Polygon:getPolygonOffset(delta, joinType, limit, autoFix) offsets (insets or outsets) the polygon by delta units--> | [[Polygon:getPolygonOffset]] ''offsets (insets or outsets) the polygon by delta units''<br/><!--GIDEROSMTD:Polygon:getPolygonOffset(delta, joinType, limit, autoFix) offsets (insets or outsets) the polygon by delta units--> | ||
[[Polygon:getLineOffset]] ''offsets an open polyline (a polygon treated as an open path) by delta units, producing one or more parallel polylines''<br/><!--GIDEROSMTD:Polygon:getLineOffset(delta, joinType, endType, limit) offsets an open polyline (a polygon treated as an open path) by delta units, producing one or more parallel polylines--> | [[Polygon:getLineOffset]] ''offsets an open polyline (a polygon treated as an open path) by delta units, producing one or more parallel polylines''<br/><!--GIDEROSMTD:Polygon:getLineOffset(delta, joinType, endType, limit) offsets an open polyline (a polygon treated as an open path) by delta units, producing one or more parallel polylines--> | ||
[[Clipper.new]] ''creates a new clipping engine''<br/><!--GIDEROSMTD:Clipper.new() creates a new clipping engine--> | |||
[[Clipper:addSubjectPolygon]] ''adds a polygon to the subject set''<br/><!--GIDEROSMTD:Clipper:addSubjectPolygon(poly) adds a polygon to the subject set--> | |||
[[Clipper:addClipPolygon]] ''adds a polygon to the clip set''<br/><!--GIDEROSMTD:Clipper:addClipPolygon(poly) adds a polygon to the clip set--> | |||
[[Clipper:clear]] ''removes all subject and clip polygons from the engine''<br/><!--GIDEROSMTD:Clipper:clear() removes all subject and clip polygons from the engine--> | |||
[[Clipper:getIntersection]] ''computes the intersection of the subject and clip polygons''<br/><!--GIDEROSMTD:Clipper:getIntersection(fillType1, fillType2) computes the intersection of the subject and clip polygons--> | |||
[[Clipper:getUnion]] ''computes the union of the subject and clip polygons''<br/><!--GIDEROSMTD:Clipper:getUnion(fillType1, fillType2) computes the union of the subject and clip polygons--> | |||
[[Clipper:getDifference]] ''computes the subject polygons minus the clip polygons''<br/><!--GIDEROSMTD:Clipper:getDifference(fillType1, fillType2) computes the subject polygons minus the clip polygons--> | |||
| style="width: 50%; vertical-align:top;"| | | style="width: 50%; vertical-align:top;"| | ||
Revision as of 02:52, 14 November 2026
Supported platforms: ![]()
![]()
![]()
![]()
![]()
![]()
![]()
![]()
Available since: Gideros 2015.03.22
Description
The Clipper plugin wraps the Clipper polygon clipping library for Gideros.
require "clipper"
Enable Clipper in Gideros Studio -> Plugins before use. This makes the two classes Polygon and Clipper available as globals.
It provides two classes:
- Polygon: a single polygon (a list of integer points). It can be created, edited, measured, cleaned, reversed, simplified and offset (inset/outset)
- Clipper: a clipping engine that combines one or more subject polygons with one or more clip polygons using boolean operations (intersection, union, difference, exclusion)
All coordinates are integers. The plugin registers a weak table that keeps the C++ objects alive as long as their Lua wrappers exist, so polygons and clippers are garbage collected automatically.
Example
MethodsPolygon.new creates an empty polygon Clipper.new creates a new clipping engine |
EventsConstants |