Skip to content
FutureBlitz

    Install

    Import std.algo.delaunay

    Delaunay

    std.algo.delaunay

    function

    @PanicsAtCaller Public Function Delaunay(points: Vec2[]): (Int, Int, Int)[]

    The Delaunay triangulation of the points: triangles whose circumcircles hold none of the points, each as the indices of its corners in points, counterclockwise. Fewer than three points, or points all on a line, have none, and of points that are equal, only the first is a corner. A coordinate that's infinite or NaN panics.

    Examples

    // A square's corners make two triangles.
    Local square = [Vec2(0, 0), Vec2(1, 0), Vec2(1, 1), Vec2(0, 1)]
    Local triangles = Delaunay(square)
    Expect(triangles.Count == 2)
    For triangle In triangles
        Local a, b, c = triangle
        Expect(a != b && b != c && a != c)
    End For

    std/algo/delaunay.fb, line 455

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