dist.point2set {pcds} | R Documentation |
Distance from a point to a set of finite cardinality
Description
Returns the Euclidean distance between a point p
and set of points Yp
and the
closest point in set Yp
to p
.
Distance between a point and a set is by definition the distance
from the point to the closest point in the set.
p
should be of finite dimension and Yp
should
be of finite cardinality and p
and elements of Yp
must have the same dimension.
Usage
dist.point2set(p, Yp)
Arguments
p |
A |
Yp |
A set of |
Value
A list
with the elements
distance |
Distance from point |
ind.cl.point |
Index of the closest point in set |
closest.point |
The closest point
in set |
Author(s)
Elvan Ceyhan
See Also
dist.point2line
and dist.point2plane
Examples
A<-c(0,0); B<-c(1,0); C<-c(1/2,sqrt(3)/2);
Te<-rbind(A,B,C);
dist.point2set(c(1,2),Te)
X2<-cbind(runif(10),runif(10))
dist.point2set(c(1,2),X2)
x<-runif(1)
y<-as.matrix(runif(10))
dist.point2set(x,y)
#this works, because x is a 1D point, and y is treated as a set of 10 1D points
#but will give an error message if y<-runif(10) is used above
[Package pcds version 0.1.8 Index]