Skip to contents

Title

Usage

st_calculateCurvature(sfPoly, smoothness = 5)

Arguments

sfPoly

POLYGON of class sf

smoothness

list; curvature measures

Value

list; list of curvatures values

References

https://stackoverflow.com/questions/62250151/calculate-curvature-of-a-closed-object-in-r

Examples

matrix_R <- matrix(c(
    0, 0, 0, 0, 0, 0, 0, 0, 0,
    0, 1, 1, 1, 1, 1, 0, 0, 0,
    0, 1, 1, 0, 0, 1, 1, 0, 0,
    0, 1, 1, 0, 0, 1, 1, 0, 0,
    0, 1, 1, 1, 1, 1, 0, 0, 0,
    0, 1, 1, 0, 1, 1, 0, 0, 0,
    0, 1, 1, 0, 0, 1, 1, 0, 0,
    0, 1, 1, 0, 0, 1, 1, 0, 0,
    0, 0, 0, 0, 0, 0, 0, 0, 0
), nrow = 9, byrow = TRUE)
poly_R <- binaryImageToSF(matrix_R, xmin = 0, xmax = 1, ymin = 0, ymax = 1)
st_calculateCurvature(poly_R)
#> $meanAbsCurv
#> [1] 5.3
#> 
#> $totalAbsCurv
#> [1] 116.6
#> 
#> $minCurv
#> [1] -9
#> 
#> $maxCurv
#> [1] 9
#>