Compute Euclidean Path Length
Arguments
- X
Finite numeric matrix whose rows are consecutive path points,
with at least one row and one column.
Value
Total Euclidean length of the polyline. Singleton paths and paths
whose points all coincide have length zero. Empty paths and total lengths
exceeding the finite numeric range are rejected.
Examples
path.length(rbind(c(0, 0), c(1, 0), c(1, 2)))
#> [1] 3
path.length(matrix(c(1, 2), nrow = 1)) # zero
#> [1] 0