spa_boundary {fsr} | R Documentation |
Capture the fuzzy boundary of a spatial plateau object
Description
spa_boundary()
yields the fuzzy boundary of a homogeneous spatial plateau object.
Usage
spa_boundary(pgo)
Arguments
pgo |
A |
Details
The spa_boundary()
function employs the definition of fuzzy boundary in the context of Spatial Plateau Algebra.
The fuzzy boundary of a fuzzy spatial object has a heterogeneous nature. For instance, the fuzzy boundary of a plateau region object consists of two parts:
a plateau line object that corresponds to the boundary of the core of
A
.a plateau region object that comprises all points of
A
with a membership degree greater than 0 and less than 1.
This means that spa_boundary()
returns a pcomposition
object.
Value
A pcomposition
object that represents a fuzzy boundary of the pgeometry
object given as input.
References
Concepts and formal definitions of fuzzy boundary are introduced in:
Examples
library(tibble)
library(sf)
library(ggplot2)
# defining two different types of membership functions
trap_mf <- function(a, b, c, d) {
function(x) {
pmax(pmin((x - a)/(b - a), 1, (d - x)/(d - c), na.rm = TRUE), 0)
}
}
set.seed(7)
tbl = tibble(x = runif(20, min = 0, max = 30),
y = runif(20, min = 0, max = 50),
z = runif(20, min = 0, max = 100))
classes <- c("cold", "hot")
cold_mf <- trap_mf(0, 10, 20, 35)
hot_mf <- trap_mf(20, 50, 100, 100)
# Getting the convex hull on the points to clip plateau region objects during their constructions
pts <- st_as_sf(tbl, coords = c(1, 2))
ch <- st_convex_hull(do.call(c, st_geometry(pts)))
# Using the standard fuzzification policy based on fuzzy sets
pregions <- spa_creator(tbl, classes = classes, mfs = c(cold_mf, hot_mf), base_poly = ch)
## Not run:
pregions
plot(pregions$pgeometry[[1]]) + ggtitle("Cold")
plot(pregions$pgeometry[[2]]) + ggtitle("Hot")
## End(Not run)
# capturing and showing the boundary of each pgeometry object previously created
boundary_cold <- spa_boundary(pregions$pgeometry[[1]])
boundary_hot <- spa_boundary(pregions$pgeometry[[2]])
## Not run:
plot(boundary_cold) + ggtitle("Boundary (Cold)")
plot(boundary_hot) + ggtitle("Boundary (Hot)")
## End(Not run)