
compute_hausdorff_distance() method for bundle objects
Source: R/shape.R
compute_hausdorff_distance-fiber-bundle-method.RdDispatches to one of three behaviours depending on y:
Arguments
- x
A bundle object.
- y
NULL, a streamline, or a bundle.
Value
A
distobject of sizex@n_streamlineswhenyisNULLor a bundle. The lower triangle stores all pairwise symmetric Hausdorff distances (computed in C++). Useas.matrix()to obtain the full \(n \times n\) matrix.A numeric vector of length
x@n_streamlineswhenyis a streamline.
Details
y = NULL: pairwise distances withinxas adistobject of size \(n\), computed in C++ via a single linear loop.yis a streamline: numeric vector of distances fromyto each streamline inx.yis a bundle:distobject for the concatenation of all streamlines fromxandy.
Examples
sl1 <- streamline(points = cbind(X = runif(10), Y = runif(10), Z = runif(10)))
sl2 <- streamline(points = cbind(X = runif(10), Y = runif(10), Z = runif(10)))
b <- bundle(streamlines = list(sl1, sl2))
# pairwise dist object (size 2)
compute_hausdorff_distance(b)
#> 1
#> 2 0.4681201
as.matrix(compute_hausdorff_distance(b))
#> 1 2
#> 1 0.0000000 0.4681201
#> 2 0.4681201 0.0000000
# distances from sl1 to each streamline in b
compute_hausdorff_distance(b, sl1)
#> [1] 0.0000000 0.4681201