A ‘metric’ is a measure of distance between points in space.
An object of class "metric"
represents such a metric,
and supports many geometrical computations that involve
the metric. See metric.object
.
The argument task
should be the name of an existing function
in the spatstat family representing a geometrical operation, such
as computing pairwise distances, nearest-neighbour distances,
the distance map, and so on. The code will determine whether
this geometrical operation has a counterpart using the specified metric,
that is defined and supported in the object m
.
If so, then this operation will be applied to the
data specified in …
, and the result will be returned.
For example, the spatstat function nndist.ppp
computes
nearest-neighbour distances using the Euclidean distance metric.
To calculate nearest-neighbour distances for a point pattern X
using another metric m
,
use invoke.metric(m, "nndist.ppp", X)
.
If evaluate=FALSE
, the computation is not performed,
and invoke.metric
simply returns a function to
perform the desired operation.