Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 2D polygon boolean operations in Geometry singleton #28987

Merged
merged 1 commit into from May 23, 2019
Merged

Add 2D polygon boolean operations in Geometry singleton #28987

merged 1 commit into from May 23, 2019

Commits on May 22, 2019

  1. 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.
    Andrii Doroshenko (Xrayez) committed May 22, 2019
    Configuration menu
    Copy the full SHA
    883ef85 View commit details
    Browse the repository at this point in the history