Learn R Programming

Momocs (version 0.1-01)

cont.smooth: Smoothes a list or a matrix of $(x; y)$ coordinates.

Description

Applies a simple algorithm to smooth outlines, particularly to remove, if needed, digitalization artefacts.

Usage

cont.smooth(M, n)

Arguments

M
list or a matrix of $(x; y)$ coordinates to smooth
n
integer indicating how many smoothing iterations to perform

Value

  • A list of smoothed coordinates.

Details

The algorithm used is simplistic: the new $(x; y)_n$ coordinates are calculated as: $$\frac{1}{4}\times(x; y)_{n-1} + \frac{1}{2}\times(x; y)_{n} + \frac{1}{4}\times(x; y)_{n+1}$$

Examples

Run this code
fake <- list(x=1:10, y=20:11)
cont.smooth(fake, 1)
cont.smooth(fake, 10)

Run the code above in your browser using DataLab