spa_boundary_pregion {fsr}R Documentation

Capture the fuzzy boundary of a plateau region object

Description

spa_boundary_pregion() yields a specific part of the fuzzy boundary of a plateau region object. This function is deprecated; use spa_boundary().

Usage

spa_boundary_pregion(pregion, bound_part = "region")

Arguments

pregion

A pregion object. It throws an error if a different type is given.

bound_part

A character value that indicates the part of the fuzzy boundary to be returned. It can be "region" or "line". See below for more details.

Details

The spa_boundary_pregion() function employs the definition of fuzzy boundary of a fuzzy region object in the context of Spatial Plateau Algebra. The fuzzy boundary of a fuzzy region object A has a heterogeneous nature since it consists of two parts:

This means that spa_boundary_pregion() can yield one specific part of the fuzzy boundary of a plateau region object. If boundary = "line", then the function returns the boundary plateau line of pregion (i.e., returns a pline object). Else if boundary = "region" (the default value), then the function returns the boundary plateau region of pregion (i.e., returns a pregion object).

This function is deprecated; use spa_boundary().

Value

A pgeometry object that represents a specific part of the fuzzy boundary of pgeometry object given as input.

References

Concepts of fuzzy boundary of plateau region objects are introduced in:

Examples

## Not run: 
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)
  }
}

trim_mf <- function(a, b, c) {
  function(x) {
    pmax(pmin((x - a)/(b - a), (c - x)/(c - b), na.rm = TRUE), 0)
  }
}

set.seed(7)
tbl = tibble(x = runif(10, min = 0, max = 30), 
             y = runif(10, min = 0, max = 50), 
             z = runif(10, min = 0, max = 100))
classes <- c("cold", "hot")
cold_mf <- trap_mf(0, 10, 20, 35)
hot_mf <- trim_mf(35, 50, 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)
plot(pregions$pgeometry[[1]]) + ggtitle("Cold")
plot(pregions$pgeometry[[2]]) + ggtitle("Hot")

# these functions are now deprecated, use `spa_boundary()`

# capturing and showing the boundary plateau line of each pgeometry object previously created
(spa_boundary_pregion(pregions$pgeometry[[1]], bound_part = "line")) 
(spa_boundary_pregion(pregions$pgeometry[[2]], bound_part = "line"))
# this part of the boundary is empty because there is no core! 
# capturing and showing the boundary plateau region (this is the default behavior)
(spa_boundary_pregion(pregions$pgeometry[[1]]))
(spa_boundary_pregion(pregions$pgeometry[[2]]))

## End(Not run)

[Package fsr version 2.0.1 Index]