Skip to contents

Fuzzy numerical operations are implemented by spatial plateau numerical operations, which extract geometric measurements from spatial plateau objects, such as the area of a plateau region object and the length of a plateau line object.

Usage

spa_avg_degree(pgo)

spa_ncomp(pgo)

spa_area(pgo)

spa_perimeter(pgo)

spa_length(pgo)

Arguments

pgo

A pgeometry object of the type PLATEAULINE, PLATEAUCOMPOSITION, or PLATEAUCOLLECTION. It throws a warning if a different type is given.

Value

A numerical value.

Details

These functions calculate numerical properties from spatial plateau objects (i.e., pgeometry objects). Some of them are type-independent. This means that the parameter can be a pgeometry object of any type. The type-independent functions are:

  • spa_avg_degree() calculates the average membership degree of a spatial plateau object.

  • spa_ncomp() returns the number of components of a spatial plateau object.

The remaining functions are type-dependent. This means that the parameter have to be of a specific type. The type-dependent functions are:

  • spa_area() computes the area of a plateau region, plateau composition, or plateau collection object.

  • spa_perimeter() computes the perimeter of a plateau region, plateau composition, or plateau collection.

  • spa_length() computes the length of a plateau line, plateau composition, or plateau collection object.

For the aforementioned functions, if the input has the incorrect data type, it throws a warning message and returns 0.

Examples

# Point components
pcp1 <- create_component("POINT(0 0)", 0.3)
pcp2 <- create_component("MULTIPOINT((2 2), (2 4), (2 0))", 0.5)
pcp3 <- create_component("MULTIPOINT((1 1), (3 1), (1 3), (3 3))", 0.9)
pcp4 <- create_component("MULTIPOINT((1 2), (2 1), (3 2))", 1)
pcp5 <- create_component("MULTIPOINT((0 0.5), (2 3))", 0.7)
pcp6 <- create_component("MULTIPOINT((0 1), (3 3.5))", 0.85)
pcp7 <- create_component("MULTIPOINT((1 0), (4 2))", 0.4)
# Line components
lcp1 <- create_component("LINESTRING(0 0, 1 1.5)", 0.2)
lcp2 <- create_component("LINESTRING(1 3, 1 2, 2 0.5)", 0.5)
lcp3 <- create_component("LINESTRING(2 1.2, 3 1.6, 4 4)", 0.7)
lcp4 <- create_component("LINESTRING(1 1.5, 2 1.2)", 1.0)
lcp5 <- create_component("LINESTRING(-1 1, 2 2)", 0.9)
# Polygon components
rcp1 <- create_component("POLYGON((0 0, 1 4, 2 2, 0 0))", 0.4)
rcp2 <- create_component("POLYGON((2 0.5, 4 1, 4 0, 2 0.5))", 0.8)

# Creating spatial plateau objects
ppoint <- create_pgeometry(list(pcp1, pcp2, pcp3, pcp4, pcp5), "PLATEAUPOINT")
pline <- create_pgeometry(list(lcp1, lcp2, lcp3), "PLATEAULINE")
pregion <- create_pgeometry(list(rcp1, rcp2), "PLATEAUREGION")
pcomp <- create_pgeometry(list(pcp6, pcp7, lcp4, lcp5), "PLATEAUCOMPOSITION")
pcol <- create_pgeometry(list(ppoint, pline, pregion, pcomp), "PLATEAUCOLLECTION")

spa_avg_degree(ppoint)
#> [1] 0.68
spa_avg_degree(pline)
#> [1] 0.4666667
spa_avg_degree(pregion)
#> [1] 0.6
spa_avg_degree(pcomp)
#> [1] 0.7875
spa_avg_degree(pcol)
#> [1] 0.6335417

spa_ncomp(ppoint)
#> [1] 5
spa_ncomp(pline)
#> [1] 3
spa_ncomp(pregion)
#> [1] 2
spa_ncomp(pcomp)
#> [1] 4
spa_ncomp(pcol)
#> [1] 14

spa_area(pregion)
#> [1] 2
spa_area(pcomp)
#> [1] 0
spa_area(pcol)
#> [1] 2

spa_perimeter(pregion)
#> [1] 7.773525
spa_perimeter(pcomp)
#> [1] 0
spa_perimeter(pcol)
#> [1] 7.773525

spa_length(pline)
#> [1] 4.335866
spa_length(pcomp)
#> [1] 3.890081
spa_length(pcol)
#> [1] 8.225947