Skip to contents

Calculates distances from the centroid to points sampled at regular intervals along the perimeter of the shape. This provides an alternative to polar sampling for shapes with complex bounds.

Usage

dper(x, y, n)

Arguments

x

A numeric vector of x-coordinates.

y

A numeric vector of y-coordinates.

n

Number of points to sample along the perimeter.

Value

A list containing:

  • dist: Radial distances from the centroid to the sampled points.

  • coords: Coordinates of the sampled points.

Examples

# Example using sample data
image_path <- system.file("extdata", "otolith.jpg", package = "aforoR")
contour <- extract_contour(preprocess_image(image_path))
perim_dists <- dper(contour[, 1], contour[, 2], n = 512)
plot(perim_dists$dist, type = "l", main = "Perimeter-based Distances")