Skip to content

sampling_util

Source: base/tealdef/mission/tasks/spawn_sims/sampling_util.d.tl

Notes

Poisson-disk sampling of points in a rectangle.

SamplingUtil

record global base/tealdef/mission/tasks/spawn_sims/sampling_util.d.tl:3

global record SamplingUtil

Load: local sampling_util = ug_require "::/mission/tasks/spawn_sims/sampling_util.tl"

Notes

Point sampling helper.

Functions

poissonDiskSampling(width : number, height : number, radius : number, sampleLimit? : integer, seed? : integer) : {Vec2f} base/tealdef/mission/tasks/spawn_sims/sampling_util.d.tl:4

Call as sampling_util.poissonDiskSampling

Notes

Returns random points in a rectangle that are at least radius apart (Poisson-disk sampling).

Parameter Type Description
width number Width of the rectangle.
height number Height of the rectangle.
radius number Minimum distance between points.
sampleLimit? integer Attempts per point (default 30).
seed? integer Random seed.

Returns {Vec2f}: Points with 0 <= x < width, 0 <= y < height.

Used in the base game: 1 time in 1 file

base/content/mission/mission/tasks/spawn_sims/spawn_sims.tl:50

local samplePoints = sampling_util.poissonDiskSampling(len1, len2, minDistanceToNeighbor, 30, seed)