Calculate elongation (aspect ratio) as length / width.
Value
If
xis a single matrix: returns a numeric scalarIf
xis a list: returns a numeric vectorIf
xis a tibble: returns a numeric vector extracted from coo column
Details
Elongation is the aspect ratio based on inertia axes: length / width. Value of 1 indicates equal length and width. Higher values indicate more elongated shapes.
This is equivalent to eccentricity based on bounding box dimensions.
Examples
get_elongation(shapes$cat)
#> length
#> 2.069434
# Use in measure()
bot %>% measure("elongation")
#> # A tibble: 40 × 4
#> coo type dummy coo_elongation
#> <out> <fct> <fct> <dbl>
#> 1 (138 x 2) whisky a 3.91
#> 2 (168 x 2) whisky a 3.82
#> 3 (189 x 2) whisky a 2.67
#> 4 (129 x 2) whisky a 4.31
#> 5 (152 x 2) whisky a 3.09
#> 6 (161 x 2) whisky a 2.52
#> 7 (124 x 2) whisky a 4.03
#> 8 (126 x 2) whisky a 3.04
#> 9 (183 x 2) whisky a 3.23
#> 10 (193 x 2) whisky a 3.93
#> # ℹ 30 more rows
