Polycenter: Center of the polygon

View source: R/polys.r

PolycenterR Documentation

Center of the polygon

Description

Finds polygon center

Usage

Polycenter(x)

Arguments

x

Polygon vertices: two-column numerical matrix or data frame

Details

Based on vegan::summary.ordihulls().

Value

Named numerical vector of length 2 (x and y coordinates of the center).

Author(s)

Alexey Shipunov

See Also

Squares, Hulls, Ellipses

Examples


x <- c(1:9, 8:1) # from ?polygon
y <- c(1, 2*(5:3), 2, -1, 17, 9, 8, 2:9)
Polycenter(cbind(x, y)) # numerical matrix
Polycenter(data.frame(x, y)) # numerical data frame

iris.p <- prcomp(iris[, -5])$x[, 1:2]
iris.h <- Hulls(iris.p, iris$Species, plot=FALSE)
sapply(iris.h, Polycenter)


shipunov documentation built on Feb. 16, 2023, 9:05 p.m.