polygon_points: Make Polygon Points

View source: R/spatial.R

polygon_pointsR Documentation

Make Polygon Points

Description

Create a series of points in a polygon with a given resolution

Usage

polygon_points(x, y, res = 20)

Arguments

x

vector of x vertices that form a closed cycle

y

vector of y vertices that form a closed cycle

res

resolution to set between vertices, i.e. number of points in each line segment

Details

x and y are vectors whose pairs give the vertices of the polygon object

This is a simple function that takes the same initial two arguments as polygon, but creates points that go over the course of the polygon edges. To create a full shape, the final vertex of the pairs x and y must match the first vertex.

Value

a matrix whose first column are the points in x and whose second column are the points in y

Examples

# make unit square
  polygon_points(c(-1,-1,1,1,-1), c(-1,1,1,-1,-1))

dannyjameswilliams/truncsm documentation built on Aug. 22, 2022, 3:44 p.m.