Skip to content
FutureBlitz

    Install

    Import std.math.polygon

    Union

    std.math.polygon

    function

    @PanicsAtCaller Public Function Union(a: Vec2[][], b: Vec2[][]): Vec2[][]

    The region filled by either a or b, or both. A corner that isn't finite panics.

    Examples

    
    Local a = [[Vec2(0, 0), Vec2(2, 0), Vec2(2, 2), Vec2(0, 2)]]
    Local b = [[Vec2(1, 0), Vec2(3, 0), Vec2(3, 2), Vec2(1, 2)]]
    Expect(PolygonArea(Union(a, b)) == 6.0)
    Expect(PolygonArea(Intersection(a, b)) == 2.0)
    Expect(PolygonArea(Difference(a, b)) == 2.0)

    std/math/polygon.fb, line 904

    Report an issue with this page or with FutureBlitz on GitHub.