metric.object {spatstat.geom} | R Documentation |
Distance Metric
Description
An object of class "metric"
defines a measure of distance
between points, and supports many operations that involve distances.
Details
A ‘metric’ d
is a measure of distance between points that
satisfies
-
d(x,x) = 0
for any pointx
, -
d(x,y) > 0
for any two distinct pointsx
andy
-
symmetry:
d(x,y) = d(y,x)
for any two pointsx
andy
-
triangle inequality:
d(x,y) \le d(x,z) + d(z,y)
for any three pointsx,y,z
.
The Euclidean distance between points is an example of a metric.
An object of class "metric"
is a structure
that defines a metric and supports many computations that involve
the metric. The internal structure of this object,
and the mechanism for performing these computations,
are under development.
Objects of class "metric"
are produced by the function
convexmetric
and possibly by other functions.
There are methods for print
and summary
for the class "metric"
.
The summary
method lists the operations that are supported
by the metric.
To perform distance calculations (for example, nearest-neighbour
distances) using a desired metric instead of the
Euclidean metric, first check whether the standard function for this
purpose (for example nndist.ppp
)
has an argument named metric
.
If so, use the standard function
and add the argument metric
; if not, use
the low-level function invoke.metric
.
Author(s)
Adrian Baddeley Adrian.Baddeley@curtin.edu.au, Rolf Turner rolfturner@posteo.net and Ege Rubak rubak@math.aau.dk.
See Also
Examples
m <- convexmetric(square(c(-1,1)))
summary(m)
y <- nndist(cells, metric=m)