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 pgeometry object of type ppoint, pline, or pregion.

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:

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

Carniel, A. C.; VenĂ¢ncio, P. V. A. B; Schneider, M. fsr: An R package for fuzzy spatial data handling. Transactions in GIS, vol. 27, no. 3, pp. 900-927, 2023.

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)

[Package fsr version 2.0.1 Index]