Learn R Programming

CspStandSegmentation (version 0.1.2)

fds: Farthest Distance Sampling (Farthest Point Sampling)

Description

This function selects n points from a matrix of points such that the minimum distance between any two points is maximized. This version is memory efficient and can handle large matrices.

Usage

fds(mat, n, ret = "idx", scale = FALSE)

Value

a vector of indices or a matrix of points

Arguments

mat

a matrix of points with one row for each point and one column for each dimension, can also be a las object then only XYZ will be used

n

the number of points to select, or if <1 the proportion of points to select

ret

the type of output to return. Options are "idx" (default) to return the indices of the selected points, "mat" to return the selected points.

scale

logical. If TRUE, the dimensions are scaled to have a mean of 0 and a standard deviation of 1 before calculating distances.

Examples

Run this code
mat <- matrix(rnorm(1000), ncol = 10)
sample <- fds(mat, 50, ret = "mat")
str(sample)


Run the code above in your browser using DataLab