nonuniformEx

fun <T> IMeshData.nonuniformEx(randomValuesUnsorted: List<Double>, randomPoints: List<Vector2>, weightFunction: WeightFunction, sampleFunction: (IIndexedPolygon, IVertexData, Barycentric) -> T): List<T>(source)

Generates a list of samples by distributing random points across the mesh using weighted areas of triangles and a provided sample function.

Return

A list of samples of type T, generated by applying the sample function to distributed random points across the mesh.

Parameters

T

The type of the sample produced by the sample function.

randomsUnsorted

A list of random values in the range [0, 1), which are used to distribute points across the mesh based on weighted triangle areas.

randomPoints

A list of random 2D points in barycentric coordinates, used to determine the position of generated samples within a triangle.

weightFunction

A function that calculates weights for vertices in a triangle, modifying the distribution of random points based on these weights.

sampleFunction

A function that generates a sample of type T given a triangle (as an IIndexedPolygon), associated vertex data, and barycentric coordinates.