Calculate the maximum distance between any two points (calliper/Feret diameter).
Value
get_calliper(): maximum distance as a numeric scalarget_calliper_ids(): indices of the two furthest points as a vector c(i, j)
Details
Calculates the maximum distance between any two points on the outline. Also known as Feret diameter or maximum calliper distance.
Uses brute force O(n²) algorithm. May be slow for outlines with many points.
Note: get_calliper_ids() returns a vector, not a scalar, so cannot be used with measure().
Examples
get_calliper(shapes$cat)
#> [1] 229.9761
get_calliper_ids(shapes$cat)
#> [1] 39 80
# Use in measure() on minibot for the sake of speed
bot[1:2, ] %>% measure("calliper")
#> # A tibble: 2 × 6
#> id coo type fake price coo_calliper
#> <chr> <out> <fct> <fct> <dbl> <dbl>
#> 1 brahma (138 x 2) whisky a 3 1088.
#> 2 caney (168 x 2) whisky a 1.2 994.
