distFct {TDA} | R Documentation |
Distance function
Description
The function distFct
computes the distance between each point of a set Grid
and the corresponding closest point of another set X
.
Usage
distFct(X, Grid)
Arguments
X |
a numeric |
Grid |
a numeric |
Details
Given a set of points X
, the distance function computed at g
is defined as
d(g) = \inf_{x \in X} \| x-g \|_2
Value
The function distFct
returns a numeric vector of length n
, where n
is the number of points stored in Grid
.
Each value in V corresponds to the distance between a point in G and the nearest point in X.
Author(s)
Fabrizio Lecci
See Also
Examples
## Generate Data from the unit circle
n <- 300
X <- circleUnif(n)
## Construct a grid of points over which we evaluate the function
interval <- 0.065
Xseq <- seq(-1.6, 1.6, by = interval)
Yseq <- seq(-1.7, 1.7, by = interval)
Grid <- expand.grid(Xseq, Yseq)
## distance fct
distance <- distFct(X, Grid)