nape-js API
    Preparing search index...

    Function generateFractureSites

    • Generate random Voronoi fracture sites within a polygon.

      Places count random points inside the given polygon using rejection sampling. Useful for generating fracture patterns.

      Parameters

      • vertices: readonly Readonly<VoronoiPoint>[]

        Polygon vertices (as VoronoiPoint[]).

      • count: number

        Number of sites to generate.

      • random: () => number = Math.random

        Optional RNG function (default Math.random).

      Returns VoronoiPoint[]

      Array of points guaranteed to be inside the polygon.