perimeter {habtools}R Documentation

Calculate perimeter of a 2D shape

Description

Calculates the perimeter of a 2D shape.

Usage

perimeter(data, keep_data = FALSE)

Arguments

data

A data frame with the first two columns ordered x and y coordinates.

keep_data

Logical. Keep lengths of all segments of the perimeter? Defaults to FALSE.

Value

The perimeter.

Examples

mcap_2d <- mesh_to_2d(mcap)
plot(mcap_2d)

perimeter(mcap_2d)

r <- 1 # radius
circ <- sim_circle(r=r) # simulate xy coordinates for a circle of radius 1
plot(circ, asp=1)
perimeter(circ)

2 * pi * r # Note xy resolution affects output


[Package habtools version 1.0.5 Index]