# NOT RUN {
library(tibble)
library(sf)
library(FuzzyR)
# some basic examples
pts1 <- rbind(c(1, 2), c(3, 2))
pts2 <- rbind(c(1, 1), c(2, 3), c(2, 1))
pts3 <- rbind(c(2, 2), c(3, 3))
cp1 <- component_from_sfg(st_multipoint(pts1), 0.3)
cp2 <- component_from_sfg(st_multipoint(pts2), 0.6)
cp3 <- component_from_sfg(st_multipoint(pts3), 1.0)
pp <- create_pgeometry(list(cp1, cp2, cp3), "PLATEAUPOINT")
spa_eval(pp, st_point(c(1, 2)))
spa_eval(pp, st_point(c(1, 3)))
# other examples with plateau regions
set.seed(345)
# some random points to create plateau region objects by using the function spa_creator
tbl = tibble(x = runif(10, min= 0, max = 20),
y = runif(10, min = 0, max = 30),
z = runif(10, min = 0, max = 100))
#getting the convex hull on the points to clipping the construction of plateau region objects
pts <- st_as_sf(tbl, coords = c(1, 2))
ch <- st_convex_hull(do.call(c, st_geometry(pts)))
pregions <- spa_creator(tbl, fuzz_policy = "fcp", k = 2, base_poly = ch)
# capturing the membership degree of a specific point in each object
spa_eval(pregions$pgeometry[[1]], st_point(c(5, 15)))
spa_eval(pregions$pgeometry[[2]], st_point(c(5, 15)))
# }
Run the code above in your browser using DataLab