Computes the euclidean distance of the position {x, y}
to all position listed in points and returns the shortest distance. The returned distance can be maximum_distance
at most.
type | :: "function-application" | |
function_name | :: "distance-from-nearest-point" | |
arguments | :: DistanceFromNearestPointArguments |
arguments | :: DistanceFromNearestPointArguments | |
function_name | :: "distance-from-nearest-point" | |
type | :: "function-application" |
Default: max double
-- Shortest distance at the current {x, y} from the two given points, but at most 1000
local noise = require("noise")
local tne = noise.to_noise_expression
local positions = noise.make_point_list({{-100, -40}, {-50, -200}})
local shortest_distance =
{
type = "function-application",
function_name = "distance-from-nearest-point",
arguments = {x = noise.var("x"), y = noise.var("y"), points = positions, maximum_distance = tne(1000)}
}
-- or with the noise lib
local also_shortest_distance = noise.function_application("distance-from-nearest-point", {x = noise.var("x"), y = noise.var("y"), points = positions, maximum_distance = 1000})