diff options
author | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-05-18 20:01:42 +0300 |
---|---|---|
committer | Andrii Doroshenko (Xrayez) <xrayez@gmail.com> | 2019-05-22 17:12:39 +0300 |
commit | 883ef8570a52977e507bf43e5a8382c8b7afee06 (patch) | |
tree | 2b80121fdeb803dc265b6aa98c859ddf1a69368f /scene/gui/graph_edit.cpp | |
parent | fa5cc1da7a83ca7bdf685ba243e207bcd5de7370 (diff) |
Expose 2D polygon boolean operations in Geometry singleton
Clipper 6.4.2 is used internally to perform polypaths clipping, as well
as inflating/deflating polypaths. The following methods were added:
```
Geometry.merge_polygons_2d(poly_a, poly_b) # union
Geometry.clip_polygons_2d(poly_a, poly_b) # difference
Geometry.intersect_polygons_2d(poly_a, poly_b) # intersection
Geometry.exclude_polygons_2d(poly_a, poly_b) # xor
Geometry.clip_polyline_with_polygon_2d(poly_a, poly_b)
Geometry.intersect_polyline_with_polygon_2d(poly_a, poly_b)
Geometry.offset_polygon_2d(polygon, delta) # inflate/deflate
Geometry.offset_polyline_2d(polyline, delta) # returns polygons
// This one helps to implement CSG-like behaviour:
Geometry.transform_points_2d(points, transform)
```
All the methods return an array of polygons/polylines. The resulting
polygons could possibly be holes which could be checked with
`Geometry.is_polygon_clockwise()` which was exposed to scripting as well.
Diffstat (limited to 'scene/gui/graph_edit.cpp')
0 files changed, 0 insertions, 0 deletions